diff options
Diffstat (limited to 'src/network')
-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 |
5 files changed, 34 insertions, 4 deletions
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); |