diff options
| author | Renato Westphal <renato@openbsd.org> | 2018-07-24 17:04:47 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-24 17:04:47 -0300 |
| commit | 5d13cd0a93a618d1e680d4711badaeb0f8abbfba (patch) | |
| tree | 0eb4ba503e4f8932773cae2e85ffd80d1136a805 /zebra/if_netlink.c | |
| parent | bbc7adf1b4c9a7af4dbcd5c37200f6e02aeabc87 (diff) | |
| parent | d23b983bd48445e7f77b9e7143cb0f8090b5585c (diff) | |
Merge pull request #2699 from sworleys/Netlink-MTU-Check
zebra: Add check for mtu on netlink RTM_NEWLINK
Diffstat (limited to 'zebra/if_netlink.c')
| -rw-r--r-- | zebra/if_netlink.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 2743f34cb4..8943b434d7 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -1230,6 +1230,12 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) /* Update interface information. */ set_ifindex(ifp, ifi->ifi_index, zns); ifp->flags = ifi->ifi_flags & 0x0000fffff; + if (!tb[IFLA_MTU]) { + zlog_warn( + "RTM_NEWLINK for interface %s(%u) without MTU set", + name, ifi->ifi_index); + return 0; + } ifp->mtu6 = ifp->mtu = *(int *)RTA_DATA(tb[IFLA_MTU]); ifp->metric = 0; ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN; @@ -1279,6 +1285,12 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) bridge_ifindex, ifi->ifi_flags); set_ifindex(ifp, ifi->ifi_index, zns); + if (!tb[IFLA_MTU]) { + zlog_warn( + "RTM_NEWLINK for interface %s(%u) without MTU set", + name, ifi->ifi_index); + return 0; + } ifp->mtu6 = ifp->mtu = *(int *)RTA_DATA(tb[IFLA_MTU]); ifp->metric = 0; |
