diff options
| author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2018-12-05 17:22:56 -0200 |
|---|---|---|
| committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2018-12-05 17:22:56 -0200 |
| commit | c69f2c1fffbae8d0bd5b69c627c4217d6ce97aed (patch) | |
| tree | 065343b631775d64def467abd8d8c2e8adfa7713 /zebra/ioctl.c | |
| parent | 86c57af534173d417189404ae005a610d84ee155 (diff) | |
zebra: don't log errors on unsupported medias
When using `SIOCGIFMEDIA` check for `EINVAL`, otherwise we might print
an error message on an unsupported interface.
FreeBSD source code reference:
https://github.com/freebsd/freebsd/blob/master/sys/net/if_media.c#L300
And:
https://github.com/freebsd/freebsd/blob/8cb4b0c0181bd45318ee8977f77aea90c53bb224/usr.sbin/rtsold/if.c#L211
/*
* EINVAL simply means that the interface does not support
* the SIOCGIFMEDIA ioctl. We regard it alive.
*/
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'zebra/ioctl.c')
| -rw-r--r-- | zebra/ioctl.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/zebra/ioctl.c b/zebra/ioctl.c index 87e98032a2..ebe1edcaef 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -415,7 +415,8 @@ 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) + if (if_ioctl(SIOCGIFMEDIA, (caddr_t)&ifmr) == -1 && + errno != EINVAL) flog_err_sys(EC_LIB_SYSTEM_CALL, "if_ioctl(SIOCGIFMEDIA) failed: %s", safe_strerror(errno)); |
