diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-03-31 22:02:37 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-04-02 03:07:08 +0900 |
commit | a27a0ad64159d6e4d5d1682b83670fc258b44426 (patch) | |
tree | 25ab00c9cdb2cfbf67a357dc8fabb73f42af8ff8 | |
parent | 4799d932b57f9acf955a067a7a1e598c6f3c7e40 (diff) | |
download | systemd-a27a0ad64159d6e4d5d1682b83670fc258b44426.tar.gz |
network: merge ipip_init() and sit_init()
-rw-r--r-- | src/network/netdev/tunnel.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c index eae31ff0a8..719b5e4add 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, |