Change in libosmocore[master]: gprs_ns2_fr: pass MTU changes to the NSE

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Mon Feb 15 03:08:45 UTC 2021


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/22909 )


Change subject: gprs_ns2_fr: pass MTU changes to the NSE
......................................................................

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.

TODO: how to report to the NS user?

Related: OS#4889
Change-Id: I946f7655c9526ffd98dabdce219c6a419b71e00c
---
M src/gb/gprs_ns2_fr.c
1 file changed, 29 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/22909/1

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;
 }

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/22909
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I946f7655c9526ffd98dabdce219c6a419b71e00c
Gerrit-Change-Number: 22909
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210215/b586ede7/attachment.htm>


More information about the gerrit-log mailing list