chiark / gitweb /
netlink: Advise netlink clients of the local link MTU
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 21 Apr 2014 19:43:06 +0000 (20:43 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 24 Apr 2014 01:32:45 +0000 (02:32 +0100)
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@chiark.greenend.org.uk>
netlink.c
secnet.h
site.c

index 787f4eb7e3c3ef8263d67344bdf831ebfdc6744f..372645615a3af5bc223a5582d5c953515148da4c 100644 (file)
--- 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[]={
index 9bec310c1b8f280a54a0dec91377faad930780f4..d5663ff980257ecfcb8b6b0736ee479e7f5eaf5f 100644 (file)
--- 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 324a2061682e69188605c04650d6e012d4993624..00a3a4c9153a8477c1d56fb041f81abdde1261b0 100644 (file)
--- 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);