* rt_netlink.c: Remove unused netlink-addr socket declaration.

* rt_netlink.c (netlink_parse_info): Fix debug messages - nlmsg_pid is
	  unsigned and one zlog call had swapped arguments.
	* rt_netlink.c (netlink_route_multipath): Fix compile with disabled
	  IPv6 support.

	[backport candidate] - with stuff commited to rt_netlink.c before to
	fix logging in netlink_route_multipath().
This commit is contained in:
hasso 2005-06-12 11:28:18 +00:00
parent 1ddd729e6f
commit 1ada81981d
2 changed files with 39 additions and 14 deletions

View File

@ -1,3 +1,11 @@
2005-06-12 Hasso Tepper <hasso at quagga.net>
* rt_netlink.c: Remove netlink-addr socket declaration, it's not used.
* rt_netlink.c (netlink_parse_info): Fix debug messages - nlmsg_pid is
unsigned and one zlog call had swapped arguments.
* rt_netlink.c (netlink_route_multipath): Fix compile with disabled
IPv6 support.
2005-05-31 Paul Jakma <paul.jakma@sun.com> 2005-05-31 Paul Jakma <paul.jakma@sun.com>
* zserv.c: (zsend_route_multipath) Fix bug if route is sent * zserv.c: (zsend_route_multipath) Fix bug if route is sent

View File

@ -49,8 +49,7 @@ struct nlsock
struct sockaddr_nl snl; struct sockaddr_nl snl;
const char *name; const char *name;
} netlink = { -1, 0, {0}, "netlink-listen"}, /* kernel messages */ } netlink = { -1, 0, {0}, "netlink-listen"}, /* kernel messages */
netlink_cmd = { -1, 0, {0}, "netlink-cmd"}, /* command channel */ netlink_cmd = { -1, 0, {0}, "netlink-cmd"}; /* command channel */
netlink_addr = { -1, 0, {0}, "netlink-addr"}; /* address channel */
struct message nlmsg_str[] = { struct message nlmsg_str[] = {
{RTM_NEWROUTE, "RTM_NEWROUTE"}, {RTM_NEWROUTE, "RTM_NEWROUTE"},
@ -391,7 +390,7 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
{ {
if (IS_ZEBRA_DEBUG_KERNEL) if (IS_ZEBRA_DEBUG_KERNEL)
{ {
zlog_debug ("%s: %s ACK: type=%s(%u), seq=%u, pid=%d", zlog_debug ("%s: %s ACK: type=%s(%u), seq=%u, pid=%u",
__FUNCTION__, nl->name, __FUNCTION__, nl->name,
lookup (nlmsg_str, err->msg.nlmsg_type), lookup (nlmsg_str, err->msg.nlmsg_type),
err->msg.nlmsg_type, err->msg.nlmsg_seq, err->msg.nlmsg_type, err->msg.nlmsg_seq,
@ -425,7 +424,7 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
loglvl = LOG_DEBUG; loglvl = LOG_DEBUG;
zlog (NULL, loglvl, "%s error: %s, type=%s(%u), " zlog (NULL, loglvl, "%s error: %s, type=%s(%u), "
"seq=%u, pid=%d", "seq=%u, pid=%u",
nl->name, safe_strerror (-errnum), nl->name, safe_strerror (-errnum),
lookup (nlmsg_str, msg_type), lookup (nlmsg_str, msg_type),
msg_type, err->msg.nlmsg_seq, err->msg.nlmsg_pid); msg_type, err->msg.nlmsg_seq, err->msg.nlmsg_pid);
@ -439,7 +438,7 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
/* OK we got netlink message. */ /* OK we got netlink message. */
if (IS_ZEBRA_DEBUG_KERNEL) if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug ("netlink_parse_info: %s type %s(%u), seq=%u, pid=%d", zlog_debug ("netlink_parse_info: %s type %s(%u), seq=%u, pid=%u",
nl->name, nl->name,
lookup (nlmsg_str, h->nlmsg_type), h->nlmsg_type, lookup (nlmsg_str, h->nlmsg_type), h->nlmsg_type,
h->nlmsg_seq, h->nlmsg_pid); h->nlmsg_seq, h->nlmsg_pid);
@ -449,7 +448,7 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
{ {
if (IS_ZEBRA_DEBUG_KERNEL) if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug ("netlink_parse_info: %s packet comes from %s", zlog_debug ("netlink_parse_info: %s packet comes from %s",
nl->name, netlink_cmd.name); netlink_cmd.name, nl->name);
continue; continue;
} }
@ -1470,9 +1469,14 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
zlog_debug zlog_debug
("netlink_route_multipath() (recursive, 1 hop): " ("netlink_route_multipath() (recursive, 1 hop): "
"%s %s/%d, type %s", lookup (nlmsg_str, cmd), "%s %s/%d, type %s", lookup (nlmsg_str, cmd),
#ifdef HAVE_IPV6
(family == AF_INET) ? inet_ntoa (p->u.prefix4) : (family == AF_INET) ? inet_ntoa (p->u.prefix4) :
inet6_ntoa (p->u.prefix6), p->prefixlen, inet6_ntoa (p->u.prefix6),
nexthop_types_desc[nexthop->rtype]); #else
inet_ntoa (p->u.prefix4),
#endif /* HAVE_IPV6 */
p->prefixlen, nexthop_types_desc[nexthop->rtype]);
} }
if (nexthop->rtype == NEXTHOP_TYPE_IPV4 if (nexthop->rtype == NEXTHOP_TYPE_IPV4
@ -1524,9 +1528,13 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
zlog_debug zlog_debug
("netlink_route_multipath() (single hop): " ("netlink_route_multipath() (single hop): "
"%s %s/%d, type %s", lookup (nlmsg_str, cmd), "%s %s/%d, type %s", lookup (nlmsg_str, cmd),
#ifdef HAVE_IPV6
(family == AF_INET) ? inet_ntoa (p->u.prefix4) : (family == AF_INET) ? inet_ntoa (p->u.prefix4) :
inet6_ntoa (p->u.prefix6), p->prefixlen, inet6_ntoa (p->u.prefix6),
nexthop_types_desc[nexthop->type]); #else
inet_ntoa (p->u.prefix4),
#endif /* HAVE_IPV6 */
p->prefixlen, nexthop_types_desc[nexthop->type]);
} }
if (nexthop->type == NEXTHOP_TYPE_IPV4 if (nexthop->type == NEXTHOP_TYPE_IPV4
@ -1611,8 +1619,13 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
{ {
zlog_debug ("netlink_route_multipath() " zlog_debug ("netlink_route_multipath() "
"(recursive, multihop): %s %s/%d type %s", "(recursive, multihop): %s %s/%d type %s",
lookup (nlmsg_str, cmd), (family == AF_INET) ? lookup (nlmsg_str, cmd),
inet_ntoa (p->u.prefix4) : inet6_ntoa (p->u.prefix6), #ifdef HAVE_IPV6
(family == AF_INET) ? inet_ntoa (p->u.prefix4) :
inet6_ntoa (p->u.prefix6),
#else
inet_ntoa (p->u.prefix4),
#endif /* HAVE_IPV6 */
p->prefixlen, nexthop_types_desc[nexthop->rtype]); p->prefixlen, nexthop_types_desc[nexthop->rtype]);
} }
if (nexthop->rtype == NEXTHOP_TYPE_IPV4 if (nexthop->rtype == NEXTHOP_TYPE_IPV4
@ -1668,9 +1681,13 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
{ {
zlog_debug ("netlink_route_multipath() (multihop): " zlog_debug ("netlink_route_multipath() (multihop): "
"%s %s/%d, type %s", lookup (nlmsg_str, cmd), "%s %s/%d, type %s", lookup (nlmsg_str, cmd),
#ifdef HAVE_IPV6
(family == AF_INET) ? inet_ntoa (p->u.prefix4) : (family == AF_INET) ? inet_ntoa (p->u.prefix4) :
inet6_ntoa (p->u.prefix6), p->prefixlen, inet6_ntoa (p->u.prefix6),
nexthop_types_desc[nexthop->type]); #else
inet_ntoa (p->u.prefix4),
#endif /* HAVE_IPV6 */
p->prefixlen, nexthop_types_desc[nexthop->type]);
} }
if (nexthop->type == NEXTHOP_TYPE_IPV4 if (nexthop->type == NEXTHOP_TYPE_IPV4
|| nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX) || nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX)