mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 07:37:29 +00:00
ospf6d: Convert to use builtin printf functionality
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
4f278784d6
commit
d47b448de5
@ -86,13 +86,9 @@ const uint16_t ospf6_lsa_minlen[OSPF6_LSTYPE_SIZE] = {
|
|||||||
|
|
||||||
static void ospf6_header_print(struct ospf6_header *oh)
|
static void ospf6_header_print(struct ospf6_header *oh)
|
||||||
{
|
{
|
||||||
char router_id[16], area_id[16];
|
zlog_debug(" OSPFv%d Type:%d Len:%hu Router-ID:%pI4", oh->version,
|
||||||
inet_ntop(AF_INET, &oh->router_id, router_id, sizeof(router_id));
|
oh->type, ntohs(oh->length), &oh->router_id);
|
||||||
inet_ntop(AF_INET, &oh->area_id, area_id, sizeof(area_id));
|
zlog_debug(" Area-ID:%pI4 Cksum:%hx Instance-ID:%d", &oh->area_id,
|
||||||
|
|
||||||
zlog_debug(" OSPFv%d Type:%d Len:%hu Router-ID:%s", oh->version,
|
|
||||||
oh->type, ntohs(oh->length), router_id);
|
|
||||||
zlog_debug(" Area-ID:%s Cksum:%hx Instance-ID:%d", area_id,
|
|
||||||
ntohs(oh->checksum), oh->instance_id);
|
ntohs(oh->checksum), oh->instance_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +96,6 @@ void ospf6_hello_print(struct ospf6_header *oh)
|
|||||||
{
|
{
|
||||||
struct ospf6_hello *hello;
|
struct ospf6_hello *hello;
|
||||||
char options[16];
|
char options[16];
|
||||||
char drouter[16], bdrouter[16], neighbor[16];
|
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
ospf6_header_print(oh);
|
ospf6_header_print(oh);
|
||||||
@ -109,8 +104,6 @@ void ospf6_hello_print(struct ospf6_header *oh)
|
|||||||
hello = (struct ospf6_hello *)((caddr_t)oh
|
hello = (struct ospf6_hello *)((caddr_t)oh
|
||||||
+ sizeof(struct ospf6_header));
|
+ sizeof(struct ospf6_header));
|
||||||
|
|
||||||
inet_ntop(AF_INET, &hello->drouter, drouter, sizeof(drouter));
|
|
||||||
inet_ntop(AF_INET, &hello->bdrouter, bdrouter, sizeof(bdrouter));
|
|
||||||
ospf6_options_printbuf(hello->options, options, sizeof(options));
|
ospf6_options_printbuf(hello->options, options, sizeof(options));
|
||||||
|
|
||||||
zlog_debug(" I/F-Id:%ld Priority:%d Option:%s",
|
zlog_debug(" I/F-Id:%ld Priority:%d Option:%s",
|
||||||
@ -118,14 +111,12 @@ void ospf6_hello_print(struct ospf6_header *oh)
|
|||||||
options);
|
options);
|
||||||
zlog_debug(" HelloInterval:%hu DeadInterval:%hu",
|
zlog_debug(" HelloInterval:%hu DeadInterval:%hu",
|
||||||
ntohs(hello->hello_interval), ntohs(hello->dead_interval));
|
ntohs(hello->hello_interval), ntohs(hello->dead_interval));
|
||||||
zlog_debug(" DR:%s BDR:%s", drouter, bdrouter);
|
zlog_debug(" DR:%pI4 BDR:%pI4", &hello->drouter, &hello->bdrouter);
|
||||||
|
|
||||||
for (p = (char *)((caddr_t)hello + sizeof(struct ospf6_hello));
|
for (p = (char *)((caddr_t)hello + sizeof(struct ospf6_hello));
|
||||||
p + sizeof(uint32_t) <= OSPF6_MESSAGE_END(oh);
|
p + sizeof(uint32_t) <= OSPF6_MESSAGE_END(oh);
|
||||||
p += sizeof(uint32_t)) {
|
p += sizeof(uint32_t))
|
||||||
inet_ntop(AF_INET, (void *)p, neighbor, sizeof(neighbor));
|
zlog_debug(" Neighbor: %pI4", p);
|
||||||
zlog_debug(" Neighbor: %s", neighbor);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(p == OSPF6_MESSAGE_END(oh));
|
assert(p == OSPF6_MESSAGE_END(oh));
|
||||||
}
|
}
|
||||||
@ -162,7 +153,6 @@ void ospf6_dbdesc_print(struct ospf6_header *oh)
|
|||||||
|
|
||||||
void ospf6_lsreq_print(struct ospf6_header *oh)
|
void ospf6_lsreq_print(struct ospf6_header *oh)
|
||||||
{
|
{
|
||||||
char id[16], adv_router[16];
|
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
ospf6_header_print(oh);
|
ospf6_header_print(oh);
|
||||||
@ -172,11 +162,9 @@ void ospf6_lsreq_print(struct ospf6_header *oh)
|
|||||||
p + sizeof(struct ospf6_lsreq_entry) <= OSPF6_MESSAGE_END(oh);
|
p + sizeof(struct ospf6_lsreq_entry) <= OSPF6_MESSAGE_END(oh);
|
||||||
p += sizeof(struct ospf6_lsreq_entry)) {
|
p += sizeof(struct ospf6_lsreq_entry)) {
|
||||||
struct ospf6_lsreq_entry *e = (struct ospf6_lsreq_entry *)p;
|
struct ospf6_lsreq_entry *e = (struct ospf6_lsreq_entry *)p;
|
||||||
inet_ntop(AF_INET, &e->adv_router, adv_router,
|
|
||||||
sizeof(adv_router));
|
zlog_debug(" [%s Id:%pI4 Adv:%pI4]",
|
||||||
inet_ntop(AF_INET, &e->id, id, sizeof(id));
|
ospf6_lstype_name(e->type), &e->id, &e->adv_router);
|
||||||
zlog_debug(" [%s Id:%s Adv:%s]", ospf6_lstype_name(e->type),
|
|
||||||
id, adv_router);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(p == OSPF6_MESSAGE_END(oh));
|
assert(p == OSPF6_MESSAGE_END(oh));
|
||||||
@ -856,15 +844,11 @@ static void ospf6_lsreq_recv(struct in6_addr *src, struct in6_addr *dst,
|
|||||||
/* Find database copy */
|
/* Find database copy */
|
||||||
lsa = ospf6_lsdb_lookup(e->type, e->id, e->adv_router, lsdb);
|
lsa = ospf6_lsdb_lookup(e->type, e->id, e->adv_router, lsdb);
|
||||||
if (lsa == NULL) {
|
if (lsa == NULL) {
|
||||||
char id[16], adv_router[16];
|
|
||||||
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) {
|
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) {
|
||||||
inet_ntop(AF_INET, &e->id, id, sizeof(id));
|
|
||||||
inet_ntop(AF_INET, &e->adv_router, adv_router,
|
|
||||||
sizeof(adv_router));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"Can't find requested [%s Id:%s Adv:%s]",
|
"Can't find requested [%s Id:%pI4 Adv:%pI4]",
|
||||||
ospf6_lstype_name(e->type), id,
|
ospf6_lstype_name(e->type), &e->id,
|
||||||
adv_router);
|
&e->adv_router);
|
||||||
}
|
}
|
||||||
thread_add_event(master, bad_lsreq, on, 0, NULL);
|
thread_add_event(master, bad_lsreq, on, 0, NULL);
|
||||||
return;
|
return;
|
||||||
@ -1321,7 +1305,6 @@ static int ospf6_rxpacket_examin(struct ospf6_interface *oi,
|
|||||||
struct ospf6_header *oh,
|
struct ospf6_header *oh,
|
||||||
const unsigned bytesonwire)
|
const unsigned bytesonwire)
|
||||||
{
|
{
|
||||||
char buf[2][INET_ADDRSTRLEN];
|
|
||||||
|
|
||||||
if (MSG_OK != ospf6_packet_examin(oh, bytesonwire))
|
if (MSG_OK != ospf6_packet_examin(oh, bytesonwire))
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
@ -1335,13 +1318,10 @@ static int ospf6_rxpacket_examin(struct ospf6_interface *oi,
|
|||||||
oi->interface->name);
|
oi->interface->name);
|
||||||
else
|
else
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"VRF %s: I/F %s Area-ID mismatch (my %s, rcvd %s)",
|
"VRF %s: I/F %s Area-ID mismatch (my %pI4, rcvd %pI4)",
|
||||||
vrf_id_to_name(oi->interface->vrf_id),
|
vrf_id_to_name(oi->interface->vrf_id),
|
||||||
oi->interface->name,
|
oi->interface->name, &oi->area->area_id,
|
||||||
inet_ntop(AF_INET, &oi->area->area_id, buf[0],
|
&oh->area_id);
|
||||||
INET_ADDRSTRLEN),
|
|
||||||
inet_ntop(AF_INET, &oh->area_id, buf[1],
|
|
||||||
INET_ADDRSTRLEN));
|
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1356,11 +1336,9 @@ static int ospf6_rxpacket_examin(struct ospf6_interface *oi,
|
|||||||
|
|
||||||
/* Router-ID check */
|
/* Router-ID check */
|
||||||
if (oh->router_id == oi->area->ospf6->router_id) {
|
if (oh->router_id == oi->area->ospf6->router_id) {
|
||||||
zlog_warn("VRF %s: I/F %s Duplicate Router-ID (%s)",
|
zlog_warn("VRF %s: I/F %s Duplicate Router-ID (%pI4)",
|
||||||
vrf_id_to_name(oi->interface->vrf_id),
|
vrf_id_to_name(oi->interface->vrf_id),
|
||||||
oi->interface->name,
|
oi->interface->name, &oh->router_id);
|
||||||
inet_ntop(AF_INET, &oh->router_id, buf[0],
|
|
||||||
INET_ADDRSTRLEN));
|
|
||||||
return MSG_NG;
|
return MSG_NG;
|
||||||
}
|
}
|
||||||
return MSG_OK;
|
return MSG_OK;
|
||||||
@ -1541,7 +1519,6 @@ int ospf6_receive(struct thread *thread)
|
|||||||
{
|
{
|
||||||
int sockfd;
|
int sockfd;
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
char srcname[64], dstname[64];
|
|
||||||
struct in6_addr src, dst;
|
struct in6_addr src, dst;
|
||||||
ifindex_t ifindex;
|
ifindex_t ifindex;
|
||||||
struct iovec iovector[2];
|
struct iovec iovector[2];
|
||||||
@ -1598,13 +1575,11 @@ int ospf6_receive(struct thread *thread)
|
|||||||
|
|
||||||
/* Log */
|
/* Log */
|
||||||
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) {
|
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) {
|
||||||
inet_ntop(AF_INET6, &src, srcname, sizeof(srcname));
|
|
||||||
inet_ntop(AF_INET6, &dst, dstname, sizeof(dstname));
|
|
||||||
zlog_debug("%s received on %s",
|
zlog_debug("%s received on %s",
|
||||||
lookup_msg(ospf6_message_type_str, oh->type, NULL),
|
lookup_msg(ospf6_message_type_str, oh->type, NULL),
|
||||||
oi->interface->name);
|
oi->interface->name);
|
||||||
zlog_debug(" src: %s", srcname);
|
zlog_debug(" src: %pI4", &src);
|
||||||
zlog_debug(" dst: %s", dstname);
|
zlog_debug(" dst: %pI4", &dst);
|
||||||
|
|
||||||
switch (oh->type) {
|
switch (oh->type) {
|
||||||
case OSPF6_MESSAGE_TYPE_HELLO:
|
case OSPF6_MESSAGE_TYPE_HELLO:
|
||||||
@ -1659,7 +1634,7 @@ static void ospf6_send(struct in6_addr *src, struct in6_addr *dst,
|
|||||||
struct ospf6_interface *oi, struct ospf6_header *oh)
|
struct ospf6_interface *oi, struct ospf6_header *oh)
|
||||||
{
|
{
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
char srcname[64], dstname[64];
|
char srcname[64];
|
||||||
struct iovec iovector[2];
|
struct iovec iovector[2];
|
||||||
|
|
||||||
/* initialize */
|
/* initialize */
|
||||||
@ -1680,7 +1655,6 @@ static void ospf6_send(struct in6_addr *src, struct in6_addr *dst,
|
|||||||
|
|
||||||
/* Log */
|
/* Log */
|
||||||
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, SEND)) {
|
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, SEND)) {
|
||||||
inet_ntop(AF_INET6, dst, dstname, sizeof(dstname));
|
|
||||||
if (src)
|
if (src)
|
||||||
inet_ntop(AF_INET6, src, srcname, sizeof(srcname));
|
inet_ntop(AF_INET6, src, srcname, sizeof(srcname));
|
||||||
else
|
else
|
||||||
@ -1689,7 +1663,7 @@ static void ospf6_send(struct in6_addr *src, struct in6_addr *dst,
|
|||||||
lookup_msg(ospf6_message_type_str, oh->type, NULL),
|
lookup_msg(ospf6_message_type_str, oh->type, NULL),
|
||||||
oi->interface->name);
|
oi->interface->name);
|
||||||
zlog_debug(" src: %s", srcname);
|
zlog_debug(" src: %s", srcname);
|
||||||
zlog_debug(" dst: %s", dstname);
|
zlog_debug(" dst: %pI4", dst);
|
||||||
|
|
||||||
switch (oh->type) {
|
switch (oh->type) {
|
||||||
case OSPF6_MESSAGE_TYPE_HELLO:
|
case OSPF6_MESSAGE_TYPE_HELLO:
|
||||||
|
@ -96,13 +96,9 @@ static int ospf6_router_id_update_zebra(ZAPI_CALLBACK_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
o->router_id_zebra = router_id.u.prefix4;
|
o->router_id_zebra = router_id.u.prefix4;
|
||||||
if (IS_OSPF6_DEBUG_ZEBRA(RECV)) {
|
if (IS_OSPF6_DEBUG_ZEBRA(RECV))
|
||||||
char buf[INET_ADDRSTRLEN];
|
zlog_debug("%s: zebra router-id %pI4 update", __func__,
|
||||||
|
&router_id.u.prefix4);
|
||||||
zlog_debug("%s: zebra router-id %s update", __func__,
|
|
||||||
inet_ntop(AF_INET, &router_id.u.prefix4, buf,
|
|
||||||
INET_ADDRSTRLEN));
|
|
||||||
}
|
|
||||||
|
|
||||||
ospf6_router_id_update(o);
|
ospf6_router_id_update(o);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user