From: Yu Watanabe Date: Sun, 31 Mar 2019 13:02:37 +0000 (+0900) Subject: network: merge ipip_init() and sit_init() X-Git-Tag: v242-rc1~21^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a27a0ad64159d6e4d5d1682b83670fc258b44426;p=thirdparty%2Fsystemd.git network: merge ipip_init() and sit_init() --- diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c index eae31ff0a82..719b5e4add5 100644 --- a/src/network/netdev/tunnel.c +++ b/src/network/netdev/tunnel.c @@ -683,20 +683,22 @@ int config_parse_6rd_prefix(const char* unit, return 0; } -static void ipip_init(NetDev *n) { - Tunnel *t = IPIP(n); +static void ipip_sit_init(NetDev *n) { + Tunnel *t; assert(n); - assert(t); - - t->pmtudisc = true; - t->fou_encap_type = FOU_ENCAP_DIRECT; -} -static void sit_init(NetDev *n) { - Tunnel *t = SIT(n); + switch (n->kind) { + case NETDEV_KIND_IPIP: + t = IPIP(n); + break; + case NETDEV_KIND_SIT: + t = SIT(n); + break; + default: + assert_not_reached("invalid netdev kind"); + } - assert(n); assert(t); t->pmtudisc = true; @@ -775,7 +777,7 @@ static void ip6tnl_init(NetDev *n) { const NetDevVTable ipip_vtable = { .object_size = sizeof(Tunnel), - .init = ipip_init, + .init = ipip_sit_init, .sections = "Match\0NetDev\0Tunnel\0", .fill_message_create = netdev_ipip_sit_fill_message_create, .create_type = NETDEV_CREATE_STACKED, @@ -784,7 +786,7 @@ const NetDevVTable ipip_vtable = { const NetDevVTable sit_vtable = { .object_size = sizeof(Tunnel), - .init = sit_init, + .init = ipip_sit_init, .sections = "Match\0NetDev\0Tunnel\0", .fill_message_create = netdev_ipip_sit_fill_message_create, .create_type = NETDEV_CREATE_STACKED,