[systemd-devel] [PATCH] networkd: Support VXlan parameters

Ronny Chevalier chevalier.ronny at gmail.com
Fri Nov 14 00:18:43 PST 2014


2014-11-14 8:44 GMT+01:00 Susant Sahani <susant at redhat.com>:
Hi,

> Add vxlan paramertes to config.
> ---
>  man/systemd.netdev.xml                  | 30 +++++++++++++
>  src/network/networkd-netdev-gperf.gperf |  7 ++-
>  src/network/networkd-netdev-vxlan.c     | 75 +++++++++++++++++++++++++++++++++
>  src/network/networkd-netdev-vxlan.h     |  8 ++++
>  src/network/networkd.h                  | 11 +++++
>  5 files changed, 130 insertions(+), 1 deletion(-)
>
> diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml
> index 275ee52..e25c1c4 100644
> --- a/man/systemd.netdev.xml
> +++ b/man/systemd.netdev.xml
> @@ -272,6 +272,36 @@
>                                                  to discover remote MAC addresses.</para>
>                                          </listitem>
>                                  </varlistentry>
> +                                <varlistentry>
> +                                        <term><varname>FDBAgeingSec=</varname></term>
> +                                        <listitem>
> +                                                <para>The lifetime of FDB entries learnt by the kernel in seconds.</para>
> +                                        </listitem>
> +                                </varlistentry>
> +                                <varlistentry>
> +                                        <term><varname>ARPProxy=</varname></term>
> +                                        <listitem>
> +                                                <para>A boolean. When true, enables ARP proxy.</para>
> +                                        </listitem>
> +                                </varlistentry>
> +                                <varlistentry>
> +                                        <term><varname>L2Miss=</varname></term>
> +                                        <listitem>
> +                                                <para>A boolean. When true, enables netlink LLADDR miss notifications.</para>
> +                                        </listitem>
> +                                </varlistentry>
> +                                <varlistentry>
> +                                        <term><varname>L3Miss=</varname></term>
> +                                        <listitem>
> +                                                <para>A boolean. When true, enables netlink IP ADDR miss notifications.</para>
> +                                        </listitem>
> +                                </varlistentry>
> +                                <varlistentry>
> +                                        <term><varname>RouteSC=</varname></term>
> +                                        <listitem>
> +                                                <para>A boolean. When true route short circuit is turned on.</para>
> +                                        </listitem>
> +                                </varlistentry>
>                          </variablelist>
>          </refsect1>
>          <refsect1>
> diff --git a/src/network/networkd-netdev-gperf.gperf b/src/network/networkd-netdev-gperf.gperf
> index c524ee5..5ee5380 100644
> --- a/src/network/networkd-netdev-gperf.gperf
> +++ b/src/network/networkd-netdev-gperf.gperf
> @@ -37,10 +37,15 @@ Tunnel.DiscoverPathMTU,  config_parse_bool,                  0,
>  Peer.Name,               config_parse_ifname,                0,                             offsetof(Veth, ifname_peer)
>  Peer.MACAddress,         config_parse_hwaddr,                0,                             offsetof(Veth, mac_peer)
>  VXLAN.Id,                config_parse_uint64,                0,                             offsetof(VxLan, id)
> -VXLAN.Group,             config_parse_tunnel_address,        0,                             offsetof(VxLan, group)
> +VXLAN.Group,             config_parse_vxlan_group_address,   0,                             offsetof(VxLan, group)
>  VXLAN.TOS,               config_parse_unsigned,              0,                             offsetof(VxLan, tos)
>  VXLAN.TTL,               config_parse_unsigned,              0,                             offsetof(VxLan, ttl)
>  VXLAN.MacLearning,       config_parse_bool,                  0,                             offsetof(VxLan, learning)
> +VXLAN.ARPProxy,          config_parse_bool,                  0,                             offsetof(VxLan, arp_proxy)
> +VXLAN.L2Miss,            config_parse_bool,                  0,                             offsetof(VxLan, l2miss)
> +VXLAN.L3Miss,            config_parse_bool,                  0,                             offsetof(VxLan, l3miss)
> +VXLAN.RouteSC,           config_parse_bool,                  0,                             offsetof(VxLan, route_short_circuit)
> +VXLAN.FDBAgeingSec,      config_parse_sec,                   0,                             offsetof(VxLan, fdb_ageing)
>  Tun.OneQueue,            config_parse_bool,                  0,                             offsetof(TunTap, one_queue)
>  Tun.MultiQueue,          config_parse_bool,                  0,                             offsetof(TunTap, multi_queue)
>  Tun.PacketInfo,          config_parse_bool,                  0,                             offsetof(TunTap, packet_info)
> diff --git a/src/network/networkd-netdev-vxlan.c b/src/network/networkd-netdev-vxlan.c
> index 326ac54..076e266 100644
> --- a/src/network/networkd-netdev-vxlan.c
> +++ b/src/network/networkd-netdev-vxlan.c
> @@ -26,6 +26,7 @@
>  #include "sd-rtnl.h"
>  #include "networkd-netdev-vxlan.h"
>  #include "networkd-link.h"
> +#include "conf-parser.h"
>  #include "missing.h"
>
>  static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
> @@ -92,9 +93,83 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_
>                  return r;
>          }
>
> +        r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_RSC, v->route_short_circuit);
> +        if (r < 0) {
> +                log_error_netdev(netdev,
> +                                 "Could not append IFLA_VXLAN_RSC attribute: %s",
> +                                 strerror(-r));
> +                return r;
> +        }
> +
> +        r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_PROXY, v->arp_proxy);
> +        if (r < 0) {
> +                log_error_netdev(netdev,
> +                                 "Could not append IFLA_VXLAN_LEARNING attribute: %s",
s/IFLA_VXLAN_LEARNING/IFLA_VXLAN_PROXY/

> +                                 strerror(-r));
> +                return r;
> +        }
> +
> +        r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L2MISS, v->l2miss);
> +        if (r < 0) {
> +                log_error_netdev(netdev,
> +                                 "Could not append IFLA_VXLAN_L2MISS attribute: %s",
> +                                 strerror(-r));
> +                return r;
> +        }
> +
> +        r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L3MISS, v->l3miss);
> +        if (r < 0) {
> +                log_error_netdev(netdev,
> +                                 "Could not append IFLA_VXLAN_L3MISS attribute: %s",
> +                                 strerror(-r));
> +                return r;
> +        }
> +
> +        if(v->fdb_ageing) {
> +                r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_AGEING, v->fdb_ageing / USEC_PER_MSEC);
s/USEC_PER_MSEC/USEC_PER_SEC/

> +                if (r < 0) {
> +                        log_error_netdev(netdev,
> +                                         "Could not append IFLA_VXLAN_AGEING attribute: %s",
> +                                         strerror(-r));
> +                        return r;
> +                }
> +        }
> +
>          return r;
>  }
>
> +int config_parse_vxlan_group_address(const char *unit,
> +                                     const char *filename,
> +                                     unsigned line,
> +                                     const char *section,
> +                                     unsigned section_line,
> +                                     const char *lvalue,
> +                                     int ltype,
> +                                     const char *rvalue,
> +                                     void *data,
> +                                     void *userdata) {
> +        Tunnel *t = userdata;
> +        union in_addr_union *addr = data, buffer;
> +        int r, f;
> +
> +        assert(filename);
> +        assert(lvalue);
> +        assert(rvalue);
> +        assert(data);
> +
> +        r = in_addr_from_string_auto(rvalue, &f, &buffer);
> +        if (r < 0) {
> +                log_syntax(unit, LOG_ERR, filename, line, EINVAL,
> +                           "vxlan multicast group address is invalid, ignoring assignment: %s", rvalue);
> +                return 0;
> +        }
> +
> +        t->family = f;
> +        *addr = buffer;
> +
> +        return 0;
> +}
> +
>  static int netdev_vxlan_verify(NetDev *netdev, const char *filename) {
>          VxLan *v = VXLAN(netdev);
>
> diff --git a/src/network/networkd-netdev-vxlan.h b/src/network/networkd-netdev-vxlan.h
> index 8c906f1..e0f2586 100644
> --- a/src/network/networkd-netdev-vxlan.h
> +++ b/src/network/networkd-netdev-vxlan.h
> @@ -34,9 +34,17 @@ struct VxLan {
>
>          uint64_t id;
>          union in_addr_union group;
> +
>          unsigned tos;
>          unsigned ttl;
> +
> +        usec_t fdb_ageing;
> +
>          bool learning;
> +        bool arp_proxy;
> +        bool route_short_circuit;
> +        bool l2miss;
> +        bool l3miss;
>  };
>
>  extern const NetDevVTable vxlan_vtable;
> diff --git a/src/network/networkd.h b/src/network/networkd.h
> index 19a661e..791f8a7 100644
> --- a/src/network/networkd.h
> +++ b/src/network/networkd.h
> @@ -259,6 +259,17 @@ int config_parse_tunnel_address(const char *unit,
>                                  void *data,
>                                  void *userdata);
>
> +int config_parse_vxlan_group_address(const char *unit,
> +                                     const char *filename,
> +                                     unsigned line,
> +                                     const char *section,
> +                                     unsigned section_line,
> +                                     const char *lvalue,
> +                                     int ltype,
> +                                     const char *rvalue,
> +                                     void *data,
> +                                     void *userdata);
> +
>  /* gperf */
>  const struct ConfigPerfItem* network_network_gperf_lookup(const char *key, unsigned length);
>
> --
> 2.1.0
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list