summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-08-17 16:56:15 +0100
committerPaul Jakma <paul@quagga.net>2008-08-22 19:56:25 +0100
commit898987e976e8f7a50a4549475ab4970a85895f31 (patch)
tree7e0b44b20459f8aa30a1c7e12e463b6088fcff74
parent30afea3b584515ba19b38fcde6f562a550c1fcab (diff)
[zebra:linux] netlink: quiet harmless errors
2008-06-17 Stephen Hemminger <stephen.hemminger@vyatta.com> * rt_netlink.c: (netlink_parse_info) There can be harmless races such as adding an existing route, or deleting an already deleted route. Don't bother logging these unless debugging is turned on. Signed-off-by: Paul Jakma <paul@quagga.net>
-rw-r--r--zebra/rt_netlink.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index a0dad997..904367e0 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -331,6 +331,8 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
if (h->nlmsg_type == NLMSG_ERROR)
{
struct nlmsgerr *err = (struct nlmsgerr *) NLMSG_DATA (h);
+ int errnum = err->error;
+ int msg_type = err->msg.nlmsg_type;
/* If the error field is zero, then this is an ACK */
if (err->error == 0)
@@ -359,27 +361,24 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
return -1;
}
- /* Deal with Error Noise - MAG */
- {
- int loglvl = LOG_ERR;
- int errnum = err->error;
- int msg_type = err->msg.nlmsg_type;
-
- if (nl == &netlink_cmd
- && (-errnum == ENODEV || -errnum == ESRCH)
- && (msg_type == RTM_NEWROUTE || msg_type == RTM_DELROUTE))
- loglvl = LOG_DEBUG;
-
- zlog (NULL, loglvl, "%s error: %s, type=%s(%u), "
- "seq=%u, pid=%u",
- nl->name, safe_strerror (-errnum),
- lookup (nlmsg_str, msg_type),
- msg_type, err->msg.nlmsg_seq, err->msg.nlmsg_pid);
- }
- /*
- ret = -1;
- continue;
- */
+ /* Deal with errors that occur because of races in link handling */
+ if (nl == &netlink_cmd
+ && ((msg_type == RTM_DELROUTE &&
+ (-errnum == ENODEV || -errnum == ESRCH))
+ || (msg_type == RTM_NEWROUTE && -errnum == EEXIST)))
+ {
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ zlog_debug ("%s: error: %s type=%s(%u), seq=%u, pid=%u",
+ nl->name, safe_strerror (-errnum),
+ lookup (nlmsg_str, msg_type),
+ msg_type, err->msg.nlmsg_seq, err->msg.nlmsg_pid);
+ return 0;
+ }
+
+ zlog_err ("%s error: %s, type=%s(%u), seq=%u, pid=%u",
+ nl->name, safe_strerror (-errnum),
+ lookup (nlmsg_str, msg_type),
+ msg_type, err->msg.nlmsg_seq, err->msg.nlmsg_pid);
return -1;
}