]> git.proxmox.com Git - systemd.git/blob - src/network/networkd-netdev-tunnel.c
Imported Upstream version 231
[systemd.git] / src / network / networkd-netdev-tunnel.c
1 /***
2 This file is part of systemd.
3
4 Copyright 2014 Susant Sahani
5
6 systemd is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
10
11 systemd is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with systemd; If not, see <http://www.gnu.org/licenses/>.
18 ***/
19
20 #include <arpa/inet.h>
21 #include <net/if.h>
22 #include <linux/ip.h>
23 #include <linux/if_tunnel.h>
24 #include <linux/ip6_tunnel.h>
25
26 #include "sd-netlink.h"
27
28 #include "conf-parser.h"
29 #include "missing.h"
30 #include "networkd-link.h"
31 #include "networkd-netdev-tunnel.h"
32 #include "parse-util.h"
33 #include "string-table.h"
34 #include "string-util.h"
35 #include "util.h"
36
37 #define DEFAULT_TNL_HOP_LIMIT 64
38 #define IP6_FLOWINFO_FLOWLABEL htobe32(0x000FFFFF)
39
40 static const char* const ip6tnl_mode_table[_NETDEV_IP6_TNL_MODE_MAX] = {
41 [NETDEV_IP6_TNL_MODE_IP6IP6] = "ip6ip6",
42 [NETDEV_IP6_TNL_MODE_IPIP6] = "ipip6",
43 [NETDEV_IP6_TNL_MODE_ANYIP6] = "any",
44 };
45
46 DEFINE_STRING_TABLE_LOOKUP(ip6tnl_mode, Ip6TnlMode);
47 DEFINE_CONFIG_PARSE_ENUM(config_parse_ip6tnl_mode, ip6tnl_mode, Ip6TnlMode, "Failed to parse ip6 tunnel Mode");
48
49 static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
50 Tunnel *t = IPIP(netdev);
51 int r;
52
53 assert(netdev);
54 assert(link);
55 assert(m);
56 assert(t);
57 assert(IN_SET(t->family, AF_INET, AF_UNSPEC));
58
59 r = sd_netlink_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
60 if (r < 0)
61 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
62
63 r = sd_netlink_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &t->local.in);
64 if (r < 0)
65 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
66
67 r = sd_netlink_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in);
68 if (r < 0)
69 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
70
71 r = sd_netlink_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
72 if (r < 0)
73 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_TTL attribute: %m");
74
75 r = sd_netlink_message_append_u8(m, IFLA_IPTUN_PMTUDISC, t->pmtudisc);
76 if (r < 0)
77 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_PMTUDISC attribute: %m");
78
79 return r;
80 }
81
82 static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
83 Tunnel *t = SIT(netdev);
84 int r;
85
86 assert(netdev);
87 assert(link);
88 assert(m);
89 assert(t);
90 assert(IN_SET(t->family, AF_INET, AF_UNSPEC));
91
92 r = sd_netlink_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
93 if (r < 0)
94 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
95
96 r = sd_netlink_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &t->local.in);
97 if (r < 0)
98 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
99
100 r = sd_netlink_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in);
101 if (r < 0)
102 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
103
104 r = sd_netlink_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
105 if (r < 0)
106 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_TTL attribute: %m");
107
108 r = sd_netlink_message_append_u8(m, IFLA_IPTUN_PMTUDISC, t->pmtudisc);
109 if (r < 0)
110 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_PMTUDISC attribute: %m");
111
112 return r;
113 }
114
115 static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
116 Tunnel *t;
117 int r;
118
119 assert(netdev);
120
121 if (netdev->kind == NETDEV_KIND_GRE)
122 t = GRE(netdev);
123 else
124 t = GRETAP(netdev);
125
126 assert(t);
127 assert(IN_SET(t->family, AF_INET, AF_UNSPEC));
128 assert(link);
129 assert(m);
130
131 r = sd_netlink_message_append_u32(m, IFLA_GRE_LINK, link->ifindex);
132 if (r < 0)
133 return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LINK attribute: %m");
134
135 r = sd_netlink_message_append_in_addr(m, IFLA_GRE_LOCAL, &t->local.in);
136 if (r < 0)
137 return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LOCAL attribute: %m");
138
139 r = sd_netlink_message_append_in_addr(m, IFLA_GRE_REMOTE, &t->remote.in);
140 if (r < 0)
141 log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_REMOTE attribute: %m");
142
143 r = sd_netlink_message_append_u8(m, IFLA_GRE_TTL, t->ttl);
144 if (r < 0)
145 return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_TTL attribute: %m");
146
147 r = sd_netlink_message_append_u8(m, IFLA_GRE_TOS, t->tos);
148 if (r < 0)
149 log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_TOS attribute: %m");
150
151 r = sd_netlink_message_append_u8(m, IFLA_GRE_PMTUDISC, t->pmtudisc);
152 if (r < 0)
153 return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_PMTUDISC attribute: %m");
154
155 return r;
156 }
157
158 static int netdev_ip6gre_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
159 Tunnel *t;
160 int r;
161
162 assert(netdev);
163
164 if (netdev->kind == NETDEV_KIND_IP6GRE)
165 t = IP6GRE(netdev);
166 else
167 t = IP6GRETAP(netdev);
168
169 assert(t);
170 assert(t->family == AF_INET6);
171 assert(link);
172 assert(m);
173
174 r = sd_netlink_message_append_u32(m, IFLA_GRE_LINK, link->ifindex);
175 if (r < 0)
176 return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LINK attribute: %m");
177
178 r = sd_netlink_message_append_in6_addr(m, IFLA_GRE_LOCAL, &t->local.in6);
179 if (r < 0)
180 return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LOCAL attribute: %m");
181
182 r = sd_netlink_message_append_in6_addr(m, IFLA_GRE_REMOTE, &t->remote.in6);
183 if (r < 0)
184 return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_REMOTE attribute: %m");
185
186 r = sd_netlink_message_append_u8(m, IFLA_GRE_TTL, t->ttl);
187 if (r < 0)
188 return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_TTL attribute: %m");
189
190 if (t->ipv6_flowlabel != _NETDEV_IPV6_FLOWLABEL_INVALID) {
191 r = sd_netlink_message_append_u32(m, IFLA_GRE_FLOWINFO, t->ipv6_flowlabel);
192 if (r < 0)
193 return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_FLOWINFO attribute: %m");
194 }
195
196 r = sd_netlink_message_append_u32(m, IFLA_GRE_FLAGS, t->flags);
197 if (r < 0)
198 return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_FLAGS attribute: %m");
199
200 return r;
201 }
202
203 static int netdev_vti_fill_message_key(NetDev *netdev, Link *link, sd_netlink_message *m) {
204 Tunnel *t = VTI(netdev);
205 uint32_t ikey, okey;
206 int r;
207
208 assert(link);
209 assert(m);
210 assert(t);
211
212 if (t->key != 0)
213 ikey = okey = htobe32(t->key);
214 else {
215 ikey = htobe32(t->ikey);
216 okey = htobe32(t->okey);
217 }
218
219 r = sd_netlink_message_append_u32(m, IFLA_VTI_IKEY, ikey);
220 if (r < 0)
221 return log_netdev_error_errno(netdev, r, "Could not append IFLA_VTI_IKEY attribute: %m");
222
223 r = sd_netlink_message_append_u32(m, IFLA_VTI_OKEY, okey);
224 if (r < 0)
225 return log_netdev_error_errno(netdev, r, "Could not append IFLA_VTI_OKEY attribute: %m");
226
227 return 0;
228 }
229
230 static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
231 Tunnel *t = VTI(netdev);
232 int r;
233
234 assert(netdev);
235 assert(link);
236 assert(m);
237 assert(t);
238 assert(t->family == AF_INET);
239
240 r = sd_netlink_message_append_u32(m, IFLA_VTI_LINK, link->ifindex);
241 if (r < 0)
242 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
243
244 r = netdev_vti_fill_message_key(netdev, link, m);
245 if (r < 0)
246 return r;
247
248 r = sd_netlink_message_append_in_addr(m, IFLA_VTI_LOCAL, &t->local.in);
249 if (r < 0)
250 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
251
252 r = sd_netlink_message_append_in_addr(m, IFLA_VTI_REMOTE, &t->remote.in);
253 if (r < 0)
254 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
255
256 return r;
257 }
258
259 static int netdev_vti6_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
260 Tunnel *t = VTI6(netdev);
261 int r;
262
263 assert(netdev);
264 assert(link);
265 assert(m);
266 assert(t);
267 assert(t->family == AF_INET6);
268
269 r = sd_netlink_message_append_u32(m, IFLA_VTI_LINK, link->ifindex);
270 if (r < 0)
271 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
272
273 r = netdev_vti_fill_message_key(netdev, link, m);
274 if (r < 0)
275 return r;
276
277 r = sd_netlink_message_append_in6_addr(m, IFLA_VTI_LOCAL, &t->local.in6);
278 if (r < 0)
279 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
280
281 r = sd_netlink_message_append_in6_addr(m, IFLA_VTI_REMOTE, &t->remote.in6);
282 if (r < 0)
283 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
284
285 return r;
286 }
287
288 static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
289 Tunnel *t = IP6TNL(netdev);
290 uint8_t proto;
291 int r;
292
293 assert(netdev);
294 assert(link);
295 assert(m);
296 assert(t);
297 assert(t->family == AF_INET6);
298
299 r = sd_netlink_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
300 if (r < 0)
301 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
302
303 r = sd_netlink_message_append_in6_addr(m, IFLA_IPTUN_LOCAL, &t->local.in6);
304 if (r < 0)
305 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
306
307 r = sd_netlink_message_append_in6_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in6);
308 if (r < 0)
309 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
310
311 r = sd_netlink_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
312 if (r < 0)
313 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_TTL attribute: %m");
314
315 if (t->ipv6_flowlabel != _NETDEV_IPV6_FLOWLABEL_INVALID) {
316 r = sd_netlink_message_append_u32(m, IFLA_IPTUN_FLOWINFO, t->ipv6_flowlabel);
317 if (r < 0)
318 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_FLOWINFO attribute: %m");
319 }
320
321 if (t->copy_dscp)
322 t->flags |= IP6_TNL_F_RCV_DSCP_COPY;
323
324 if (t->encap_limit != IPV6_DEFAULT_TNL_ENCAP_LIMIT) {
325 r = sd_netlink_message_append_u8(m, IFLA_IPTUN_ENCAP_LIMIT, t->encap_limit);
326 if (r < 0)
327 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_ENCAP_LIMIT attribute: %m");
328 }
329
330 r = sd_netlink_message_append_u32(m, IFLA_IPTUN_FLAGS, t->flags);
331 if (r < 0)
332 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_FLAGS attribute: %m");
333
334 switch (t->ip6tnl_mode) {
335 case NETDEV_IP6_TNL_MODE_IP6IP6:
336 proto = IPPROTO_IPV6;
337 break;
338 case NETDEV_IP6_TNL_MODE_IPIP6:
339 proto = IPPROTO_IPIP;
340 break;
341 case NETDEV_IP6_TNL_MODE_ANYIP6:
342 default:
343 proto = 0;
344 break;
345 }
346
347 r = sd_netlink_message_append_u8(m, IFLA_IPTUN_PROTO, proto);
348 if (r < 0)
349 return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_MODE attribute: %m");
350
351 return r;
352 }
353
354 static int netdev_tunnel_verify(NetDev *netdev, const char *filename) {
355 Tunnel *t = NULL;
356
357 assert(netdev);
358 assert(filename);
359
360 switch (netdev->kind) {
361 case NETDEV_KIND_IPIP:
362 t = IPIP(netdev);
363 break;
364 case NETDEV_KIND_SIT:
365 t = SIT(netdev);
366 break;
367 case NETDEV_KIND_GRE:
368 t = GRE(netdev);
369 break;
370 case NETDEV_KIND_GRETAP:
371 t = GRETAP(netdev);
372 break;
373 case NETDEV_KIND_IP6GRE:
374 t = IP6GRE(netdev);
375 break;
376 case NETDEV_KIND_IP6GRETAP:
377 t = IP6GRETAP(netdev);
378 break;
379 case NETDEV_KIND_VTI:
380 t = VTI(netdev);
381 break;
382 case NETDEV_KIND_VTI6:
383 t = VTI6(netdev);
384 break;
385 case NETDEV_KIND_IP6TNL:
386 t = IP6TNL(netdev);
387 break;
388 default:
389 assert_not_reached("Invalid tunnel kind");
390 }
391
392 assert(t);
393
394 if (t->family != AF_INET && t->family != AF_INET6 && t->family != 0) {
395 log_warning("Tunnel with invalid address family configured in %s. Ignoring", filename);
396 return -EINVAL;
397 }
398
399 if (netdev->kind == NETDEV_KIND_IP6TNL) {
400 if (t->ip6tnl_mode == _NETDEV_IP6_TNL_MODE_INVALID) {
401 log_warning("IP6 Tunnel without mode configured in %s. Ignoring", filename);
402 return -EINVAL;
403 }
404 }
405
406 return 0;
407 }
408
409 int config_parse_tunnel_address(const char *unit,
410 const char *filename,
411 unsigned line,
412 const char *section,
413 unsigned section_line,
414 const char *lvalue,
415 int ltype,
416 const char *rvalue,
417 void *data,
418 void *userdata) {
419 Tunnel *t = userdata;
420 union in_addr_union *addr = data, buffer;
421 int r, f;
422
423 assert(filename);
424 assert(lvalue);
425 assert(rvalue);
426 assert(data);
427
428 if (streq(rvalue, "any")) {
429 t->family = 0;
430 return 0;
431 } else {
432
433 r = in_addr_from_string_auto(rvalue, &f, &buffer);
434 if (r < 0) {
435 log_syntax(unit, LOG_ERR, filename, line, r, "Tunnel address is invalid, ignoring assignment: %s", rvalue);
436 return 0;
437 }
438
439 if (t->family != AF_UNSPEC && t->family != f) {
440 log_syntax(unit, LOG_ERR, filename, line, 0, "Tunnel addresses incompatible, ignoring assignment: %s", rvalue);
441 return 0;
442 }
443 }
444
445 t->family = f;
446 *addr = buffer;
447
448 return 0;
449 }
450
451 int config_parse_tunnel_key(const char *unit,
452 const char *filename,
453 unsigned line,
454 const char *section,
455 unsigned section_line,
456 const char *lvalue,
457 int ltype,
458 const char *rvalue,
459 void *data,
460 void *userdata) {
461 union in_addr_union buffer;
462 Tunnel *t = userdata;
463 uint32_t k;
464 int r;
465
466 assert(filename);
467 assert(lvalue);
468 assert(rvalue);
469 assert(data);
470
471 r = in_addr_from_string(AF_INET, rvalue, &buffer);
472 if (r < 0) {
473 r = safe_atou32(rvalue, &k);
474 if (r < 0) {
475 log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse tunnel key ignoring assignment: %s", rvalue);
476 return 0;
477 }
478 } else
479 k = be32toh(buffer.in.s_addr);
480
481 if (streq(lvalue, "Key"))
482 t->key = k;
483 else if (streq(lvalue, "InputKey"))
484 t->ikey = k;
485 else
486 t->okey = k;
487
488 return 0;
489 }
490
491 int config_parse_ipv6_flowlabel(const char* unit,
492 const char *filename,
493 unsigned line,
494 const char *section,
495 unsigned section_line,
496 const char *lvalue,
497 int ltype,
498 const char *rvalue,
499 void *data,
500 void *userdata) {
501 IPv6FlowLabel *ipv6_flowlabel = data;
502 Tunnel *t = userdata;
503 int k = 0;
504 int r;
505
506 assert(filename);
507 assert(lvalue);
508 assert(rvalue);
509 assert(ipv6_flowlabel);
510
511 if (streq(rvalue, "inherit")) {
512 *ipv6_flowlabel = IP6_FLOWINFO_FLOWLABEL;
513 t->flags |= IP6_TNL_F_USE_ORIG_FLOWLABEL;
514 } else {
515 r = config_parse_int(unit, filename, line, section, section_line, lvalue, ltype, rvalue, &k, userdata);
516 if (r < 0)
517 return r;
518
519 if (k > 0xFFFFF)
520 log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse IPv6 flowlabel option, ignoring: %s", rvalue);
521 else {
522 *ipv6_flowlabel = htobe32(k) & IP6_FLOWINFO_FLOWLABEL;
523 t->flags &= ~IP6_TNL_F_USE_ORIG_FLOWLABEL;
524 }
525 }
526
527 return 0;
528 }
529
530 int config_parse_encap_limit(const char* unit,
531 const char *filename,
532 unsigned line,
533 const char *section,
534 unsigned section_line,
535 const char *lvalue,
536 int ltype,
537 const char *rvalue,
538 void *data,
539 void *userdata) {
540 Tunnel *t = userdata;
541 int k = 0;
542 int r;
543
544 assert(filename);
545 assert(lvalue);
546 assert(rvalue);
547
548 if (streq(rvalue, "none"))
549 t->flags |= IP6_TNL_F_IGN_ENCAP_LIMIT;
550 else {
551 r = safe_atoi(rvalue, &k);
552 if (r < 0) {
553 log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse Tunnel Encapsulation Limit option, ignoring: %s", rvalue);
554 return 0;
555 }
556
557 if (k > 255 || k < 0)
558 log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid Tunnel Encapsulation value, ignoring: %d", k);
559 else {
560 t->encap_limit = k;
561 t->flags &= ~IP6_TNL_F_IGN_ENCAP_LIMIT;
562 }
563 }
564
565 return 0;
566 }
567
568 static void ipip_init(NetDev *n) {
569 Tunnel *t = IPIP(n);
570
571 assert(n);
572 assert(t);
573
574 t->pmtudisc = true;
575 t->family = AF_UNSPEC;
576 }
577
578 static void sit_init(NetDev *n) {
579 Tunnel *t = SIT(n);
580
581 assert(n);
582 assert(t);
583
584 t->pmtudisc = true;
585 t->family = AF_UNSPEC;
586 }
587
588 static void vti_init(NetDev *n) {
589 Tunnel *t;
590
591 assert(n);
592
593 if (n->kind == NETDEV_KIND_VTI)
594 t = VTI(n);
595 else
596 t = VTI6(n);
597
598 assert(t);
599
600 t->pmtudisc = true;
601 }
602
603 static void gre_init(NetDev *n) {
604 Tunnel *t;
605
606 assert(n);
607
608 if (n->kind == NETDEV_KIND_GRE)
609 t = GRE(n);
610 else
611 t = GRETAP(n);
612
613 assert(t);
614
615 t->pmtudisc = true;
616 t->family = AF_UNSPEC;
617 }
618
619 static void ip6gre_init(NetDev *n) {
620 Tunnel *t;
621
622 assert(n);
623
624 if (n->kind == NETDEV_KIND_IP6GRE)
625 t = IP6GRE(n);
626 else
627 t = IP6GRETAP(n);
628
629 assert(t);
630
631 t->ttl = DEFAULT_TNL_HOP_LIMIT;
632 }
633
634 static void ip6tnl_init(NetDev *n) {
635 Tunnel *t = IP6TNL(n);
636
637 assert(n);
638 assert(t);
639
640 t->ttl = DEFAULT_TNL_HOP_LIMIT;
641 t->encap_limit = IPV6_DEFAULT_TNL_ENCAP_LIMIT;
642 t->ip6tnl_mode = _NETDEV_IP6_TNL_MODE_INVALID;
643 t->ipv6_flowlabel = _NETDEV_IPV6_FLOWLABEL_INVALID;
644 }
645
646 const NetDevVTable ipip_vtable = {
647 .object_size = sizeof(Tunnel),
648 .init = ipip_init,
649 .sections = "Match\0NetDev\0Tunnel\0",
650 .fill_message_create = netdev_ipip_fill_message_create,
651 .create_type = NETDEV_CREATE_STACKED,
652 .config_verify = netdev_tunnel_verify,
653 };
654
655 const NetDevVTable sit_vtable = {
656 .object_size = sizeof(Tunnel),
657 .init = sit_init,
658 .sections = "Match\0NetDev\0Tunnel\0",
659 .fill_message_create = netdev_sit_fill_message_create,
660 .create_type = NETDEV_CREATE_STACKED,
661 .config_verify = netdev_tunnel_verify,
662 };
663
664 const NetDevVTable vti_vtable = {
665 .object_size = sizeof(Tunnel),
666 .init = vti_init,
667 .sections = "Match\0NetDev\0Tunnel\0",
668 .fill_message_create = netdev_vti_fill_message_create,
669 .create_type = NETDEV_CREATE_STACKED,
670 .config_verify = netdev_tunnel_verify,
671 };
672
673 const NetDevVTable vti6_vtable = {
674 .object_size = sizeof(Tunnel),
675 .init = vti_init,
676 .sections = "Match\0NetDev\0Tunnel\0",
677 .fill_message_create = netdev_vti6_fill_message_create,
678 .create_type = NETDEV_CREATE_STACKED,
679 .config_verify = netdev_tunnel_verify,
680 };
681
682 const NetDevVTable gre_vtable = {
683 .object_size = sizeof(Tunnel),
684 .init = gre_init,
685 .sections = "Match\0NetDev\0Tunnel\0",
686 .fill_message_create = netdev_gre_fill_message_create,
687 .create_type = NETDEV_CREATE_STACKED,
688 .config_verify = netdev_tunnel_verify,
689 };
690
691 const NetDevVTable gretap_vtable = {
692 .object_size = sizeof(Tunnel),
693 .init = gre_init,
694 .sections = "Match\0NetDev\0Tunnel\0",
695 .fill_message_create = netdev_gre_fill_message_create,
696 .create_type = NETDEV_CREATE_STACKED,
697 .config_verify = netdev_tunnel_verify,
698 };
699
700 const NetDevVTable ip6gre_vtable = {
701 .object_size = sizeof(Tunnel),
702 .init = ip6gre_init,
703 .sections = "Match\0NetDev\0Tunnel\0",
704 .fill_message_create = netdev_ip6gre_fill_message_create,
705 .create_type = NETDEV_CREATE_STACKED,
706 .config_verify = netdev_tunnel_verify,
707 };
708
709 const NetDevVTable ip6gretap_vtable = {
710 .object_size = sizeof(Tunnel),
711 .init = ip6gre_init,
712 .sections = "Match\0NetDev\0Tunnel\0",
713 .fill_message_create = netdev_ip6gre_fill_message_create,
714 .create_type = NETDEV_CREATE_STACKED,
715 .config_verify = netdev_tunnel_verify,
716 };
717
718 const NetDevVTable ip6tnl_vtable = {
719 .object_size = sizeof(Tunnel),
720 .init = ip6tnl_init,
721 .sections = "Match\0NetDev\0Tunnel\0",
722 .fill_message_create = netdev_ip6tnl_fill_message_create,
723 .create_type = NETDEV_CREATE_STACKED,
724 .config_verify = netdev_tunnel_verify,
725 };