preserve mtu upon interface flapping and tunnel source change.
Signed-off-by:Reuben Dowle <reuben.dowle@4rf.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
stream_putl(s, ifp->ifindex);
stream_putl(s, link_idx);
stream_putl(s, link_vrf_id);
+ stream_putl(s, 0); /* mtu provisioning */
stream_putw_at(s, 0, stream_get_endp(s));
zclient_send_message(zclient);
}
char buf[];
} *req = buf;
uint32_t link_idx;
+ unsigned int mtu;
struct rtattr *rta_info, *rta_data;
if (buflen < sizeof(*req))
req->ifi.ifi_index = dplane_ctx_get_ifindex(ctx);
req->ifi.ifi_change = 0xFFFFFFFF;
link_idx = dplane_ctx_gre_get_link_ifindex(ctx);
+ mtu = dplane_ctx_gre_get_mtu(ctx);
+
+ if (mtu && !nl_attr_put32(&req->n, buflen, IFLA_MTU, mtu))
+ return 0;
rta_info = nl_attr_nest(&req->n, buflen, IFLA_LINKINFO);
if (!rta_info)
vrf_id_t vrf_id = zvrf->vrf->vrf_id;
struct zebra_if *zif, *gre_zif;
struct zebra_l2info_gre *gre_info;
+ unsigned int mtu;
s = msg;
STREAM_GETL(s, idx);
ifp = if_lookup_by_index(idx, vrf_id);
STREAM_GETL(s, link_idx);
STREAM_GETL(s, link_vrf_id);
+ STREAM_GETL(s, mtu);
ifp_link = if_lookup_by_index(link_idx, link_vrf_id);
if (!ifp_link || !ifp) {
if (!gre_info)
return;
- /* if gre link already set */
- if (gre_zif->link && gre_zif->link == ifp_link)
+ if (!mtu)
+ mtu = ifp->mtu;
+
+ /* if gre link already set or mtu did not change, do not set it */
+ if (gre_zif->link && gre_zif->link == ifp_link && mtu == ifp->mtu)
return;
- dplane_gre_set(ifp, ifp_link);
+ dplane_gre_set(ifp, ifp_link, mtu);
stream_failure:
return;
struct dplane_gre_ctx {
uint32_t link_ifindex;
+ unsigned int mtu;
};
/*
* The context block used to exchange info about route updates across
return ctx->u.gre.link_ifindex;
}
+unsigned int
+dplane_ctx_gre_get_mtu(const struct zebra_dplane_ctx *ctx)
+{
+ DPLANE_CTX_VALID(ctx);
+
+ return ctx->u.gre.mtu;
+}
+
/* Accessors for PBR rule information */
int dplane_ctx_rule_get_sock(const struct zebra_dplane_ctx *ctx)
{
* Common helper api for GRE set
*/
enum zebra_dplane_result
-dplane_gre_set(struct interface *ifp, struct interface *ifp_link)
+dplane_gre_set(struct interface *ifp, struct interface *ifp_link, unsigned int mtu)
{
enum zebra_dplane_result result = ZEBRA_DPLANE_REQUEST_FAILURE;
struct zebra_dplane_ctx *ctx;
else
ctx->u.gre.link_ifindex = 0;
+ ctx->u.gre.mtu = mtu;
+
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
/* Enqueue context for processing */
/* Accessor for GRE set */
uint32_t
dplane_ctx_gre_get_link_ifindex(const struct zebra_dplane_ctx *ctx);
+unsigned int
+dplane_ctx_gre_get_mtu(const struct zebra_dplane_ctx *ctx);
/* Namespace info - esp. for netlink communication */
const struct zebra_dplane_info *dplane_ctx_get_ns(
* Enqueue a GRE set
*/
enum zebra_dplane_result
-dplane_gre_set(struct interface *ifp, struct interface *ifp_link);
+dplane_gre_set(struct interface *ifp, struct interface *ifp_link,
+ unsigned int mtu);
/* Forward ref of zebra_pbr_rule */
struct zebra_pbr_rule;