2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2015-02-04 07:01:14 +01:00
|
|
|
/*
|
2017-05-13 10:25:29 +02:00
|
|
|
* PIM for Quagga
|
|
|
|
* Copyright (C) 2008 Everton da Silva Marques
|
|
|
|
*/
|
2015-02-04 07:01:14 +01:00
|
|
|
|
2015-09-15 10:53:09 +02:00
|
|
|
#include <zebra.h>
|
|
|
|
|
2015-02-04 07:01:14 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "log.h"
|
|
|
|
|
|
|
|
#include "pim_str.h"
|
|
|
|
|
2016-09-02 16:50:50 +02:00
|
|
|
void pim_addr_dump(const char *onfail, struct prefix *p, char *buf,
|
|
|
|
int buf_size)
|
|
|
|
{
|
|
|
|
int save_errno = errno;
|
|
|
|
|
|
|
|
if (!inet_ntop(p->family, &p->u.prefix, buf, buf_size)) {
|
|
|
|
zlog_warn("pim_addr_dump: inet_ntop(buf_size=%d): errno=%d: %s",
|
|
|
|
buf_size, errno, safe_strerror(errno));
|
|
|
|
if (onfail)
|
|
|
|
snprintf(buf, buf_size, "%s", onfail);
|
|
|
|
}
|
|
|
|
|
|
|
|
errno = save_errno;
|
|
|
|
}
|