chiark / gitweb /
networkd: sit-tunnel add support for pmtudisc
authorSusant Sahani <susant@redhat.com>
Thu, 22 May 2014 06:29:19 +0000 (11:59 +0530)
committerTom Gundersen <teg@jklm.no>
Mon, 2 Jun 2014 14:16:02 +0000 (16:16 +0200)
This patch adds path of mtu discovery for sit tunnel.
To enable/disable DiscoverPathMTU is introduced.

Example configuration

file: sit.netdev
[NetDev]
Name=sit-tun
Kind=sit
MTUBytes=1480

[Tunnel]
DiscoverPathMTU=1
Local=X.X.X.X
Remote=X.X.X.X

By default pmtudisc is turned on , if DiscoverPathMTU
is missing from the config. To turn it off
DiscoverPathMTU=0 needs to be set.

src/network/networkd-netdev-gperf.gperf
src/network/networkd-netdev.c
src/network/networkd-tunnel.c
src/network/networkd.h

index f39c922..dff0ae6 100644 (file)
@@ -29,4 +29,5 @@ Tunnel.Local,            config_parse_tunnel_address,        0,
 Tunnel.Remote,           config_parse_tunnel_address,        0,                             offsetof(NetDev, tunnel_remote)
 Tunnel.TOS,              config_parse_unsigned,              0,                             offsetof(NetDev, tunnel_tos)
 Tunnel.TTL,              config_parse_unsigned,              0,                             offsetof(NetDev, tunnel_ttl)
+Tunnel.DiscoverPathMTU,  config_parse_bool,                  0,                             offsetof(NetDev, tunnel_pmtudisc)
 Peer.Name,               config_parse_ifname,                0,                             offsetof(NetDev, ifname_peer)
index 1036daf..4439374 100644 (file)
@@ -545,6 +545,7 @@ static int netdev_load_one(Manager *manager, const char *filename) {
         netdev->kind = _NETDEV_KIND_INVALID;
         netdev->macvlan_mode = _NETDEV_MACVLAN_MODE_INVALID;
         netdev->vlanid = VLANID_MAX + 1;
+        netdev->tunnel_pmtudisc = true;
 
         r = config_parse(NULL, filename, file, "Match\0NetDev\0VLAN\0MACVLAN\0Tunnel\0Peer\0",
                          config_item_perf_lookup, (void*) network_netdev_gperf_lookup,
index 9b4cb4f..1a06a17 100644 (file)
@@ -207,6 +207,14 @@ static int netdev_fill_sit_rtnl_message(Link *link, sd_rtnl_message *m) {
                 return r;
         }
 
+        r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_PMTUDISC, netdev->tunnel_pmtudisc);
+        if (r < 0) {
+                log_error_netdev(netdev,
+                                 "Could not append IFLA_IPTUN_PMTUDISC attribute: %s",
+                                 strerror(-r));
+                return r;
+        }
+
         r = sd_rtnl_message_close_container(m);
         if (r < 0) {
                 log_error_netdev(netdev,
index e504854..6f69c9a 100644 (file)
@@ -109,6 +109,7 @@ struct NetDev {
         int ifindex;
         NetDevState state;
 
+        bool tunnel_pmtudisc;
         unsigned tunnel_ttl;
         unsigned tunnel_tos;
         struct in_addr tunnel_local;