gprs_ns2_fr: pass MTU changes to the NSE

When the MTU of the frame relay device changes, update the bind
and notify all NSEs.

Related: OS#4889
Change-Id: I946f7655c9526ffd98dabdce219c6a419b71e00c
diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 445f00a..6ba2268 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -596,6 +596,27 @@
 	bpriv->if_running = if_running;
 }
 
+static void mtu_change(struct gprs_ns2_vc_bind *bind, uint32_t mtu)
+{
+	struct priv_bind *bpriv = bind->priv;
+	struct gprs_ns2_nse *nse;
+
+	if (mtu == bind->mtu)
+		return;
+
+	LOGBIND(bind, LOGL_INFO, "MTU changed from %d to %d.\n",
+		bind->mtu, mtu);
+
+	/* 2 byte DLCI header */
+	bind->mtu = mtu - 2;
+	if (!bpriv->if_running)
+		return;
+
+	llist_for_each_entry(nse, &bind->nsi->nse, list) {
+		ns2_nse_update_mtu(nse);
+	}
+}
+
 /* handle a single netlink message received via libmnl */
 static int linkmon_mnl_cb(const struct nlmsghdr *nlh, void *data)
 {
@@ -623,8 +644,14 @@
 	if_running = !!(ifm->ifi_flags & IFF_RUNNING);
 
 	bind = bind4netdev(nsi, ifname);
-	if (bind)
-		link_state_change(bind, if_running);
+	if (!bind)
+		return MNL_CB_OK;
+
+	if (tb[IFLA_MTU]) {
+		mtu_change(bind, mnl_attr_get_u32(tb[IFLA_MTU]));
+	}
+
+	link_state_change(bind, if_running);
 
 	return MNL_CB_OK;
 }