aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2021-02-15 02:58:22 +0100
committerlynxis lazus <lynxis@fe80.eu>2021-02-19 10:41:50 +0000
commit3de1cb0d727c6175745db90ce8614ff6607b6961 (patch)
treec8bbf01ae1b7fe31baa7806ef3ece21b7ba98732
parent67725e2920662f739d4a6626442079e30f0f272c (diff)
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
-rw-r--r--src/gb/gprs_ns2_fr.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 445f00ac..6ba22687 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -596,6 +596,27 @@ static void link_state_change(struct gprs_ns2_vc_bind *bind, bool if_running)
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 @@ static int linkmon_mnl_cb(const struct nlmsghdr *nlh, void *data)
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;
}