[PATCH 19/21] netlink: Advise netlink clients of the local link MTU

Ian Jackson ijackson at chiark.greenend.org.uk
Thu Apr 24 02:37:38 BST 2014


>From the netlink client's point of view this is advisory: it may be
that other peers (perhaps reached via that netlink) would prefer a
larger or smaller MTU.

This information will be consumed in later patches.

Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
---
 netlink.c |    6 +++++-
 secnet.h  |    2 +-
 site.c    |    2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/netlink.c b/netlink.c
index 787f4eb..3726456 100644
--- a/netlink.c
+++ b/netlink.c
@@ -1028,12 +1028,16 @@ static void netlink_inst_set_mtu(void *sst, int32_t new_mtu)
 }
 
 static void netlink_inst_reg(void *sst, netlink_deliver_fn *deliver, 
-			     void *dst)
+			     void *dst, uint32_t *localmtu_r)
 {
     struct netlink_client *c=sst;
+    struct netlink *st=c->nst;
 
     c->deliver=deliver;
     c->dst=dst;
+
+    if (localmtu_r)
+	*localmtu_r=st->mtu;
 }
 
 static struct flagstr netlink_option_table[]={
diff --git a/secnet.h b/secnet.h
index 9bec310..d5663ff 100644
--- a/secnet.h
+++ b/secnet.h
@@ -431,7 +431,7 @@ typedef void netlink_deliver_fn(void *st, struct buffer_if *buf);
 #define MAXIMUM_LINK_QUALITY 3
 typedef void netlink_link_quality_fn(void *st, uint32_t quality);
 typedef void netlink_register_fn(void *st, netlink_deliver_fn *deliver,
-				 void *dst);
+				 void *dst, uint32_t *localmtu_r /* NULL ok */);
 typedef void netlink_output_config_fn(void *st, struct buffer_if *buf);
 typedef bool_t netlink_check_config_fn(void *st, struct buffer_if *buf);
 typedef void netlink_set_mtu_fn(void *st, int32_t new_mtu);
diff --git a/site.c b/site.c
index 324a206..00a3a4c 100644
--- a/site.c
+++ b/site.c
@@ -1837,7 +1837,7 @@ static list_t *site_apply(closure_t *self, struct cloc loc, dict_t *context,
     }
 
     /* We need to register the remote networks with the netlink device */
-    st->netlink->reg(st->netlink->st, site_outgoing, st);
+    st->netlink->reg(st->netlink->st, site_outgoing, st, 0);
     
     for (i=0; i<st->ncomms; i++)
 	st->comms[i]->request_notify(st->comms[i]->st, st, site_incoming);
-- 
1.7.10.4




More information about the sgo-software-discuss mailing list