]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: silence harmless log message on *BSD
authorRenato Westphal <renato@opensourcerouting.org>
Fri, 29 Jun 2018 21:40:38 +0000 (18:40 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Fri, 29 Jun 2018 22:02:10 +0000 (19:02 -0300)
The SIOCGIFMEDIA ioctl returns EINVAL when a virtual interface is
given (e.g. tunnel interfaces). This was making zebra produce lots of
irrelevant log messages during startup, which were a source of concern
for many users. Silence these log messages since they can't be avoided
and are harmless.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
zebra/ioctl.c

index 8e3a1d1a036307ea1d024dda8124579556a8dc42..aebb31af7016f8a294d6706f71b801cfaecaea19 100644 (file)
@@ -395,10 +395,13 @@ void if_get_flags(struct interface *ifp)
                strncpy(ifmr.ifm_name, ifp->name, IFNAMSIZ);
 
                /* Seems not all interfaces implement this ioctl */
-               if (if_ioctl(SIOCGIFMEDIA, (caddr_t)&ifmr) < 0)
-                       zlog_err("if_ioctl(SIOCGIFMEDIA) failed: %s",
-                                safe_strerror(errno));
-               else if (ifmr.ifm_status & IFM_AVALID) /* Link state is valid */
+               if (if_ioctl(SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
+                       /* Ignore EINVAL to avoid being too verbose */
+                       if (errno != EINVAL)
+                               zlog_err("if_ioctl(SIOCGIFMEDIA) failed: %s",
+                                        safe_strerror(errno));
+               } else if (ifmr.ifm_status
+                          & IFM_AVALID) /* Link state is valid */
                {
                        if (ifmr.ifm_status & IFM_ACTIVE)
                                SET_FLAG(ifreq.ifr_flags, IFF_RUNNING);