summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Worley <sworley@cumulusnetworks.com>2018-07-20 16:10:43 -0400
committerStephen Worley <sworley@cumulusnetworks.com>2018-07-23 12:17:45 -0400
commitd23b983bd48445e7f77b9e7143cb0f8090b5585c (patch)
tree952fd4b927f1951404c3c4cef83e938b96c66c0b
parentc4aee4fe3133127f16d3967e74e52b262438d57f (diff)
zebra: Add check for mtu on netlink RTM_NEWLINK
Zebra needed a check for mtu from the message it received from the kernel before adding the new link. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
-rw-r--r--zebra/if_netlink.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index 8f6e31cfa8..56bff0d3f6 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -1218,6 +1218,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;
@@ -1267,6 +1273,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;