zebra: implement per-route mtu handling
This commits allow overriding MTU using netlink attributes on
per-route basis. This is useful for routing protocols that can
advertice prefix specific MTUs between routers (e.g. NHRP).
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
diff --git a/zebra/zserv.c b/zebra/zserv.c
index e26c8ca..7a75ed4 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -455,6 +455,8 @@
stream_putc (s, rib->distance);
SET_FLAG (zapi_flags, ZAPI_MESSAGE_METRIC);
stream_putl (s, rib->metric);
+ SET_FLAG (zapi_flags, ZAPI_MESSAGE_MTU);
+ stream_putl (s, rib->mtu);
}
/* write real message flags value */
@@ -903,6 +905,9 @@
if (CHECK_FLAG (message, ZAPI_MESSAGE_METRIC))
rib->metric = stream_getl (s);
+ if (CHECK_FLAG (message, ZAPI_MESSAGE_MTU))
+ rib->mtu = stream_getl (s);
+
/* Table */
rib->table=zebrad.rtm_table_default;
rib_add_ipv4_multipath (&p, rib, safi);
@@ -1092,15 +1097,20 @@
api.metric = stream_getl (s);
else
api.metric = 0;
+
+ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_MTU))
+ api.mtu = stream_getl (s);
+ else
+ api.mtu = 0;
if (IN6_IS_ADDR_UNSPECIFIED (&nexthop))
rib_add_ipv6 (api.type, api.flags, &p, NULL, ifindex,
vrf_id, zebrad.rtm_table_default, api.metric,
- api.distance, api.safi);
+ api.mtu, api.distance, api.safi);
else
rib_add_ipv6 (api.type, api.flags, &p, &nexthop, ifindex,
vrf_id, zebrad.rtm_table_default, api.metric,
- api.distance, api.safi);
+ api.mtu, api.distance, api.safi);
return 0;
}