diff options
author | Susant Sahani <susant@redhat.com> | 2014-12-20 13:35:06 +0530 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-01-22 21:29:41 +0100 |
commit | 1af2536acf8aecc3eb940d04268a419c956ee10a (patch) | |
tree | 41494d788c0bf6dca9bacabe5ae9a0d786bddc10 /src | |
parent | 34109a531fb3b26fa00f0261987c7cca710e42aa (diff) |
networkd: introduce gretap
This patch introdeces gretap to networkd
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd/sd-rtnl/rtnl-types.c | 3 | ||||
-rw-r--r-- | src/libsystemd/sd-rtnl/rtnl-types.h | 1 | ||||
-rw-r--r-- | src/network/networkd-netdev-tunnel.c | 32 | ||||
-rw-r--r-- | src/network/networkd-netdev-tunnel.h | 1 | ||||
-rw-r--r-- | src/network/networkd-netdev.c | 2 | ||||
-rw-r--r-- | src/network/networkd-netdev.h | 2 | ||||
-rw-r--r-- | src/network/networkd-network.c | 1 |
7 files changed, 38 insertions, 4 deletions
diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c index b0bd661b84..97b3ceec12 100644 --- a/src/libsystemd/sd-rtnl/rtnl-types.c +++ b/src/libsystemd/sd-rtnl/rtnl-types.c @@ -165,6 +165,7 @@ static const char* const nl_union_link_info_data_table[_NL_UNION_LINK_INFO_DATA_ [NL_UNION_LINK_INFO_DATA_VXLAN] = "vxlan", [NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL] = "ipip", [NL_UNION_LINK_INFO_DATA_IPGRE_TUNNEL] = "gre", + [NL_UNION_LINK_INFO_DATA_IPGRETAP_TUNNEL] = "gretap", [NL_UNION_LINK_INFO_DATA_SIT_TUNNEL] = "sit", [NL_UNION_LINK_INFO_DATA_VTI_TUNNEL] = "vti", }; @@ -190,6 +191,8 @@ static const NLTypeSystem rtnl_link_info_data_type_systems[_NL_UNION_LINK_INFO_D .types = rtnl_link_info_data_iptun_types }, [NL_UNION_LINK_INFO_DATA_IPGRE_TUNNEL] = { .max = ELEMENTSOF(rtnl_link_info_data_ipgre_types) - 1, .types = rtnl_link_info_data_ipgre_types }, + [NL_UNION_LINK_INFO_DATA_IPGRETAP_TUNNEL] = { .max = ELEMENTSOF(rtnl_link_info_data_ipgre_types) - 1, + .types = rtnl_link_info_data_ipgre_types }, [NL_UNION_LINK_INFO_DATA_SIT_TUNNEL] = { .max = ELEMENTSOF(rtnl_link_info_data_iptun_types) - 1, .types = rtnl_link_info_data_iptun_types }, [NL_UNION_LINK_INFO_DATA_VTI_TUNNEL] = { .max = ELEMENTSOF(rtnl_link_info_data_ipvti_types) - 1, diff --git a/src/libsystemd/sd-rtnl/rtnl-types.h b/src/libsystemd/sd-rtnl/rtnl-types.h index 1bb17a4cda..aacea19986 100644 --- a/src/libsystemd/sd-rtnl/rtnl-types.h +++ b/src/libsystemd/sd-rtnl/rtnl-types.h @@ -75,6 +75,7 @@ typedef enum NLUnionLinkInfoData { NL_UNION_LINK_INFO_DATA_VXLAN, NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL, NL_UNION_LINK_INFO_DATA_IPGRE_TUNNEL, + NL_UNION_LINK_INFO_DATA_IPGRETAP_TUNNEL, NL_UNION_LINK_INFO_DATA_SIT_TUNNEL, NL_UNION_LINK_INFO_DATA_VTI_TUNNEL, _NL_UNION_LINK_INFO_DATA_MAX, diff --git a/src/network/networkd-netdev-tunnel.c b/src/network/networkd-netdev-tunnel.c index 31d34644ed..fde08fb1e6 100644 --- a/src/network/networkd-netdev-tunnel.c +++ b/src/network/networkd-netdev-tunnel.c @@ -140,14 +140,20 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me } static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) { - Tunnel *t = GRE(netdev); + Tunnel *t; int r; assert(netdev); - assert(link); - assert(m); + + if (netdev->kind == NETDEV_KIND_GRE) + t = GRE(netdev); + else + t = GRETAP(netdev); + assert(t); assert(t->family == AF_INET); + assert(link); + assert(m); r = sd_rtnl_message_append_u32(m, IFLA_GRE_LINK, link->ifindex); if (r < 0) { @@ -253,6 +259,9 @@ static int netdev_tunnel_verify(NetDev *netdev, const char *filename) { case NETDEV_KIND_GRE: t = GRE(netdev); break; + case NETDEV_KIND_GRETAP: + t = GRETAP(netdev); + break; case NETDEV_KIND_VTI: t = VTI(netdev); break; @@ -339,9 +348,15 @@ static void vti_init(NetDev *n) { } static void gre_init(NetDev *n) { - Tunnel *t = GRE(n); + Tunnel *t; assert(n); + + if (n->kind == NETDEV_KIND_GRE) + t = GRE(n); + else + t = GRETAP(n); + assert(t); t->pmtudisc = true; @@ -382,3 +397,12 @@ const NetDevVTable gre_vtable = { .create_type = NETDEV_CREATE_STACKED, .config_verify = netdev_tunnel_verify, }; + +const NetDevVTable gretap_vtable = { + .object_size = sizeof(Tunnel), + .init = gre_init, + .sections = "Match\0NetDev\0Tunnel\0", + .fill_message_create = netdev_gre_fill_message_create, + .create_type = NETDEV_CREATE_STACKED, + .config_verify = netdev_tunnel_verify, +}; diff --git a/src/network/networkd-netdev-tunnel.h b/src/network/networkd-netdev-tunnel.h index 000a6460e7..b6f6c9df76 100644 --- a/src/network/networkd-netdev-tunnel.h +++ b/src/network/networkd-netdev-tunnel.h @@ -41,3 +41,4 @@ extern const NetDevVTable ipip_vtable; extern const NetDevVTable sit_vtable; extern const NetDevVTable vti_vtable; extern const NetDevVTable gre_vtable; +extern const NetDevVTable gretap_vtable; diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index 89efc8814b..4e1fb43200 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -39,6 +39,7 @@ const NetDevVTable * const netdev_vtable[_NETDEV_KIND_MAX] = { [NETDEV_KIND_VXLAN] = &vxlan_vtable, [NETDEV_KIND_IPIP] = &ipip_vtable, [NETDEV_KIND_GRE] = &gre_vtable, + [NETDEV_KIND_GRETAP] = &gretap_vtable, [NETDEV_KIND_SIT] = &sit_vtable, [NETDEV_KIND_VTI] = &vti_vtable, [NETDEV_KIND_VETH] = &veth_vtable, @@ -56,6 +57,7 @@ static const char* const netdev_kind_table[_NETDEV_KIND_MAX] = { [NETDEV_KIND_VXLAN] = "vxlan", [NETDEV_KIND_IPIP] = "ipip", [NETDEV_KIND_GRE] = "gre", + [NETDEV_KIND_GRETAP] = "gretap", [NETDEV_KIND_SIT] = "sit", [NETDEV_KIND_VETH] = "veth", [NETDEV_KIND_VTI] = "vti", diff --git a/src/network/networkd-netdev.h b/src/network/networkd-netdev.h index 1b311c6785..3c447958a6 100644 --- a/src/network/networkd-netdev.h +++ b/src/network/networkd-netdev.h @@ -47,6 +47,7 @@ typedef enum NetDevKind { NETDEV_KIND_VXLAN, NETDEV_KIND_IPIP, NETDEV_KIND_GRE, + NETDEV_KIND_GRETAP, NETDEV_KIND_SIT, NETDEV_KIND_VETH, NETDEV_KIND_VTI, @@ -163,6 +164,7 @@ DEFINE_CAST(IPVLAN, IPVlan); DEFINE_CAST(VXLAN, VxLan); DEFINE_CAST(IPIP, Tunnel); DEFINE_CAST(GRE, Tunnel); +DEFINE_CAST(GRETAP, Tunnel); DEFINE_CAST(SIT, Tunnel); DEFINE_CAST(VTI, Tunnel); DEFINE_CAST(VETH, Veth); diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index b82452640a..2b555efd5c 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -452,6 +452,7 @@ int config_parse_tunnel(const char *unit, if (netdev->kind != NETDEV_KIND_IPIP && netdev->kind != NETDEV_KIND_SIT && netdev->kind != NETDEV_KIND_GRE && + netdev->kind != NETDEV_KIND_GRETAP && netdev->kind != NETDEV_KIND_VTI) { log_syntax(unit, LOG_ERR, filename, line, EINVAL, "NetDev is not a tunnel, ignoring assignment: %s", rvalue); |