2 * link_gre6.c gre driver module
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
9 * Authors: Dmitry Kozlov <xeb@mail.ru>
15 #include <sys/types.h>
16 #include <sys/socket.h>
17 #include <arpa/inet.h>
20 #include <linux/if_tunnel.h>
21 #include <linux/ip6_tunnel.h>
25 #include "ip_common.h"
28 #define IP6_FLOWINFO_TCLASS htonl(0x0FF00000)
29 #define IP6_FLOWINFO_FLOWLABEL htonl(0x000FFFFF)
31 #define DEFAULT_TNL_HOP_LIMIT (64)
33 static void gre_print_help(struct link_util
*lu
, int argc
, char **argv
, FILE *f
)
36 "Usage: ... %-9s [ remote ADDR ]\n",
42 " [ [i|o]key KEY | no[i|o]key ]\n"
43 " [ [no][i|o]csum ]\n"
45 " [ encaplimit ELIM ]\n"
46 " [ tclass TCLASS ]\n"
47 " [ flowlabel FLOWLABEL ]\n"
51 " [ [no]allow-localremote ]\n"
54 " [ encap { fou | gue | none } ]\n"
55 " [ encap-sport PORT ]\n"
56 " [ encap-dport PORT ]\n"
57 " [ [no]encap-csum ]\n"
58 " [ [no]encap-csum6 ]\n"
59 " [ [no]encap-remcsum ]\n"
60 " [ erspan_ver version ]\n"
62 " [ erspan_dir { ingress | egress } ]\n"
63 " [ erspan_hwid hwid ]\n"
67 "Where: ADDR := IPV6_ADDRESS\n"
68 " TTL := { 0..255 } (default=%d)\n"
69 " KEY := { DOTTED_QUAD | NUMBER }\n"
70 " ELIM := { none | 0..255 }(default=%d)\n"
71 " TCLASS := { 0x0..0xff | inherit }\n"
72 " FLOWLABEL := { 0x0..0xfffff | inherit }\n"
73 " MARK := { 0x0..0xffffffff | inherit }\n",
74 DEFAULT_TNL_HOP_LIMIT
, IPV6_DEFAULT_TNL_ENCAP_LIMIT
78 static int gre_parse_opt(struct link_util
*lu
, int argc
, char **argv
,
81 struct ifinfomsg
*ifi
= NLMSG_DATA(n
);
86 .n
.nlmsg_len
= NLMSG_LENGTH(sizeof(*ifi
)),
87 .n
.nlmsg_flags
= NLM_F_REQUEST
,
88 .n
.nlmsg_type
= RTM_GETLINK
,
89 .i
.ifi_family
= preferred_family
,
90 .i
.ifi_index
= ifi
->ifi_index
,
92 struct nlmsghdr
*answer
;
93 struct rtattr
*tb
[IFLA_MAX
+ 1];
94 struct rtattr
*linkinfo
[IFLA_INFO_MAX
+1];
95 struct rtattr
*greinfo
[IFLA_GRE_MAX
+ 1];
101 inet_prefix saddr
, daddr
;
102 __u8 hop_limit
= DEFAULT_TNL_HOP_LIMIT
;
103 __u8 encap_limit
= IPV6_DEFAULT_TNL_ENCAP_LIMIT
;
108 __u16 encapflags
= TUNNEL_ENCAP_FLAG_CSUM6
;
109 __u16 encapsport
= 0;
110 __u16 encapdport
= 0;
113 __u32 erspan_idx
= 0;
116 __u16 erspan_hwid
= 0;
118 inet_prefix_reset(&saddr
);
119 inet_prefix_reset(&daddr
);
121 if (!(n
->nlmsg_flags
& NLM_F_CREATE
)) {
122 const struct rtattr
*rta
;
124 if (rtnl_talk(&rth
, &req
.n
, &answer
) < 0) {
127 "Failed to get existing tunnel info.\n");
131 len
= answer
->nlmsg_len
;
132 len
-= NLMSG_LENGTH(sizeof(*ifi
));
136 parse_rtattr(tb
, IFLA_MAX
, IFLA_RTA(NLMSG_DATA(answer
)), len
);
138 if (!tb
[IFLA_LINKINFO
])
141 parse_rtattr_nested(linkinfo
, IFLA_INFO_MAX
, tb
[IFLA_LINKINFO
]);
143 if (!linkinfo
[IFLA_INFO_DATA
])
146 parse_rtattr_nested(greinfo
, IFLA_GRE_MAX
,
147 linkinfo
[IFLA_INFO_DATA
]);
149 rta
= greinfo
[IFLA_GRE_LOCAL
];
150 if (rta
&& get_addr_rta(&saddr
, rta
, AF_INET6
))
153 rta
= greinfo
[IFLA_GRE_REMOTE
];
154 if (rta
&& get_addr_rta(&daddr
, rta
, AF_INET6
))
157 if (greinfo
[IFLA_GRE_IKEY
])
158 ikey
= rta_getattr_u32(greinfo
[IFLA_GRE_IKEY
]);
160 if (greinfo
[IFLA_GRE_OKEY
])
161 okey
= rta_getattr_u32(greinfo
[IFLA_GRE_OKEY
]);
163 if (greinfo
[IFLA_GRE_IFLAGS
])
164 iflags
= rta_getattr_u16(greinfo
[IFLA_GRE_IFLAGS
]);
166 if (greinfo
[IFLA_GRE_OFLAGS
])
167 oflags
= rta_getattr_u16(greinfo
[IFLA_GRE_OFLAGS
]);
169 if (greinfo
[IFLA_GRE_TTL
])
170 hop_limit
= rta_getattr_u8(greinfo
[IFLA_GRE_TTL
]);
172 if (greinfo
[IFLA_GRE_LINK
])
173 link
= rta_getattr_u32(greinfo
[IFLA_GRE_LINK
]);
175 if (greinfo
[IFLA_GRE_ENCAP_LIMIT
])
176 encap_limit
= rta_getattr_u8(greinfo
[IFLA_GRE_ENCAP_LIMIT
]);
178 if (greinfo
[IFLA_GRE_FLOWINFO
])
179 flowinfo
= rta_getattr_u32(greinfo
[IFLA_GRE_FLOWINFO
]);
181 if (greinfo
[IFLA_GRE_FLAGS
])
182 flags
= rta_getattr_u32(greinfo
[IFLA_GRE_FLAGS
]);
184 if (greinfo
[IFLA_GRE_ENCAP_TYPE
])
185 encaptype
= rta_getattr_u16(greinfo
[IFLA_GRE_ENCAP_TYPE
]);
187 if (greinfo
[IFLA_GRE_ENCAP_FLAGS
])
188 encapflags
= rta_getattr_u16(greinfo
[IFLA_GRE_ENCAP_FLAGS
]);
190 if (greinfo
[IFLA_GRE_ENCAP_SPORT
])
191 encapsport
= rta_getattr_u16(greinfo
[IFLA_GRE_ENCAP_SPORT
]);
193 if (greinfo
[IFLA_GRE_ENCAP_DPORT
])
194 encapdport
= rta_getattr_u16(greinfo
[IFLA_GRE_ENCAP_DPORT
]);
196 if (greinfo
[IFLA_GRE_COLLECT_METADATA
])
199 if (greinfo
[IFLA_GRE_FWMARK
])
200 fwmark
= rta_getattr_u32(greinfo
[IFLA_GRE_FWMARK
]);
202 if (greinfo
[IFLA_GRE_ERSPAN_INDEX
])
203 erspan_idx
= rta_getattr_u32(greinfo
[IFLA_GRE_ERSPAN_INDEX
]);
205 if (greinfo
[IFLA_GRE_ERSPAN_VER
])
206 erspan_ver
= rta_getattr_u8(greinfo
[IFLA_GRE_ERSPAN_VER
]);
208 if (greinfo
[IFLA_GRE_ERSPAN_DIR
])
209 erspan_dir
= rta_getattr_u8(greinfo
[IFLA_GRE_ERSPAN_DIR
]);
211 if (greinfo
[IFLA_GRE_ERSPAN_HWID
])
212 erspan_hwid
= rta_getattr_u16(greinfo
[IFLA_GRE_ERSPAN_HWID
]);
218 if (!matches(*argv
, "key")) {
222 ikey
= okey
= tnl_parse_key("key", *argv
);
223 } else if (!matches(*argv
, "nokey")) {
227 } else if (!matches(*argv
, "ikey")) {
230 ikey
= tnl_parse_key("ikey", *argv
);
231 } else if (!matches(*argv
, "noikey")) {
234 } else if (!matches(*argv
, "okey")) {
237 okey
= tnl_parse_key("okey", *argv
);
238 } else if (!matches(*argv
, "nookey")) {
241 } else if (!matches(*argv
, "seq")) {
244 } else if (!matches(*argv
, "noseq")) {
247 } else if (!matches(*argv
, "iseq")) {
249 } else if (!matches(*argv
, "noiseq")) {
251 } else if (!matches(*argv
, "oseq")) {
253 } else if (!matches(*argv
, "nooseq")) {
255 } else if (!matches(*argv
, "csum")) {
258 } else if (!matches(*argv
, "nocsum")) {
261 } else if (!matches(*argv
, "icsum")) {
263 } else if (!matches(*argv
, "noicsum")) {
265 } else if (!matches(*argv
, "ocsum")) {
267 } else if (!matches(*argv
, "noocsum")) {
269 } else if (!matches(*argv
, "remote")) {
271 get_addr(&daddr
, *argv
, AF_INET6
);
272 } else if (!matches(*argv
, "local")) {
274 get_addr(&saddr
, *argv
, AF_INET6
);
275 } else if (!matches(*argv
, "dev")) {
277 link
= ll_name_to_index(*argv
);
280 } else if (!matches(*argv
, "ttl") ||
281 !matches(*argv
, "hoplimit") ||
282 !matches(*argv
, "hlim")) {
284 if (strcmp(*argv
, "inherit") != 0) {
285 if (get_u8(&hop_limit
, *argv
, 0))
286 invarg("invalid HLIM\n", *argv
);
289 } else if (!matches(*argv
, "tos") ||
290 !matches(*argv
, "tclass") ||
291 !matches(*argv
, "dsfield")) {
295 flowinfo
&= ~IP6_FLOWINFO_TCLASS
;
296 if (strcmp(*argv
, "inherit") == 0)
297 flags
|= IP6_TNL_F_USE_ORIG_TCLASS
;
299 if (get_u8(&uval
, *argv
, 16))
300 invarg("invalid TClass", *argv
);
301 flowinfo
|= htonl((__u32
)uval
<< 20) & IP6_FLOWINFO_TCLASS
;
302 flags
&= ~IP6_TNL_F_USE_ORIG_TCLASS
;
304 } else if (strcmp(*argv
, "flowlabel") == 0 ||
305 strcmp(*argv
, "fl") == 0) {
309 flowinfo
&= ~IP6_FLOWINFO_FLOWLABEL
;
310 if (strcmp(*argv
, "inherit") == 0)
311 flags
|= IP6_TNL_F_USE_ORIG_FLOWLABEL
;
313 if (get_u32(&uval
, *argv
, 16))
314 invarg("invalid Flowlabel", *argv
);
316 invarg("invalid Flowlabel", *argv
);
317 flowinfo
|= htonl(uval
) & IP6_FLOWINFO_FLOWLABEL
;
318 flags
&= ~IP6_TNL_F_USE_ORIG_FLOWLABEL
;
320 } else if (strcmp(*argv
, "dscp") == 0) {
322 if (strcmp(*argv
, "inherit") != 0)
323 invarg("not inherit", *argv
);
324 flags
|= IP6_TNL_F_RCV_DSCP_COPY
;
325 } else if (strcmp(*argv
, "noencap") == 0) {
326 encaptype
= TUNNEL_ENCAP_NONE
;
327 } else if (strcmp(*argv
, "encap") == 0) {
329 if (strcmp(*argv
, "fou") == 0)
330 encaptype
= TUNNEL_ENCAP_FOU
;
331 else if (strcmp(*argv
, "gue") == 0)
332 encaptype
= TUNNEL_ENCAP_GUE
;
333 else if (strcmp(*argv
, "none") == 0)
334 encaptype
= TUNNEL_ENCAP_NONE
;
336 invarg("Invalid encap type.", *argv
);
337 } else if (strcmp(*argv
, "encap-sport") == 0) {
339 if (strcmp(*argv
, "auto") == 0)
341 else if (get_u16(&encapsport
, *argv
, 0))
342 invarg("Invalid source port.", *argv
);
343 } else if (strcmp(*argv
, "encap-dport") == 0) {
345 if (get_u16(&encapdport
, *argv
, 0))
346 invarg("Invalid destination port.", *argv
);
347 } else if (strcmp(*argv
, "encap-csum") == 0) {
348 encapflags
|= TUNNEL_ENCAP_FLAG_CSUM
;
349 } else if (strcmp(*argv
, "noencap-csum") == 0) {
350 encapflags
&= ~TUNNEL_ENCAP_FLAG_CSUM
;
351 } else if (strcmp(*argv
, "encap-udp6-csum") == 0) {
352 encapflags
|= TUNNEL_ENCAP_FLAG_CSUM6
;
353 } else if (strcmp(*argv
, "noencap-udp6-csum") == 0) {
354 encapflags
&= ~TUNNEL_ENCAP_FLAG_CSUM6
;
355 } else if (strcmp(*argv
, "encap-remcsum") == 0) {
356 encapflags
|= TUNNEL_ENCAP_FLAG_REMCSUM
;
357 } else if (strcmp(*argv
, "noencap-remcsum") == 0) {
358 encapflags
&= ~TUNNEL_ENCAP_FLAG_REMCSUM
;
359 } else if (strcmp(*argv
, "external") == 0) {
361 } else if (strcmp(*argv
, "fwmark") == 0) {
363 if (strcmp(*argv
, "inherit") == 0) {
364 flags
|= IP6_TNL_F_USE_ORIG_FWMARK
;
367 if (get_u32(&fwmark
, *argv
, 0))
368 invarg("invalid fwmark\n", *argv
);
369 flags
&= ~IP6_TNL_F_USE_ORIG_FWMARK
;
371 } else if (strcmp(*argv
, "allow-localremote") == 0) {
372 flags
|= IP6_TNL_F_ALLOW_LOCAL_REMOTE
;
373 } else if (strcmp(*argv
, "noallow-localremote") == 0) {
374 flags
&= ~IP6_TNL_F_ALLOW_LOCAL_REMOTE
;
375 } else if (strcmp(*argv
, "encaplimit") == 0) {
377 if (strcmp(*argv
, "none") == 0) {
378 flags
|= IP6_TNL_F_IGN_ENCAP_LIMIT
;
382 if (get_u8(&uval
, *argv
, 0))
383 invarg("invalid ELIM", *argv
);
385 flags
&= ~IP6_TNL_F_IGN_ENCAP_LIMIT
;
387 } else if (strcmp(*argv
, "erspan") == 0) {
389 if (get_u32(&erspan_idx
, *argv
, 0))
390 invarg("invalid erspan index\n", *argv
);
391 if (erspan_idx
& ~((1<<20) - 1) || erspan_idx
== 0)
392 invarg("erspan index must be > 0 and <= 20-bit\n", *argv
);
393 } else if (strcmp(*argv
, "erspan_ver") == 0) {
395 if (get_u8(&erspan_ver
, *argv
, 0))
396 invarg("invalid erspan version\n", *argv
);
397 if (erspan_ver
!= 1 && erspan_ver
!= 2)
398 invarg("erspan version must be 1 or 2\n", *argv
);
399 } else if (strcmp(*argv
, "erspan_dir") == 0) {
401 if (matches(*argv
, "ingress") == 0)
403 else if (matches(*argv
, "egress") == 0)
406 invarg("Invalid erspan direction.", *argv
);
407 } else if (strcmp(*argv
, "erspan_hwid") == 0) {
409 if (get_u16(&erspan_hwid
, *argv
, 0))
410 invarg("invalid erspan hwid\n", *argv
);
412 gre_print_help(lu
, argc
, argv
, stderr
);
419 addattr_l(n
, 1024, IFLA_GRE_COLLECT_METADATA
, NULL
, 0);
423 addattr32(n
, 1024, IFLA_GRE_IKEY
, ikey
);
424 addattr32(n
, 1024, IFLA_GRE_OKEY
, okey
);
425 addattr_l(n
, 1024, IFLA_GRE_IFLAGS
, &iflags
, 2);
426 addattr_l(n
, 1024, IFLA_GRE_OFLAGS
, &oflags
, 2);
427 if (is_addrtype_inet_not_unspec(&saddr
))
428 addattr_l(n
, 1024, IFLA_GRE_LOCAL
, saddr
.data
, saddr
.bytelen
);
429 if (is_addrtype_inet_not_unspec(&daddr
))
430 addattr_l(n
, 1024, IFLA_GRE_REMOTE
, daddr
.data
, daddr
.bytelen
);
432 addattr32(n
, 1024, IFLA_GRE_LINK
, link
);
433 addattr_l(n
, 1024, IFLA_GRE_TTL
, &hop_limit
, 1);
434 addattr_l(n
, 1024, IFLA_GRE_ENCAP_LIMIT
, &encap_limit
, 1);
435 addattr_l(n
, 1024, IFLA_GRE_FLOWINFO
, &flowinfo
, 4);
436 addattr32(n
, 1024, IFLA_GRE_FLAGS
, flags
);
437 addattr32(n
, 1024, IFLA_GRE_FWMARK
, fwmark
);
439 addattr8(n
, 1024, IFLA_GRE_ERSPAN_VER
, erspan_ver
);
440 if (erspan_ver
== 1 && erspan_idx
!= 0) {
441 addattr32(n
, 1024, IFLA_GRE_ERSPAN_INDEX
, erspan_idx
);
442 } else if (erspan_ver
== 2) {
443 addattr8(n
, 1024, IFLA_GRE_ERSPAN_DIR
, erspan_dir
);
444 addattr16(n
, 1024, IFLA_GRE_ERSPAN_HWID
, erspan_hwid
);
447 addattr16(n
, 1024, IFLA_GRE_ENCAP_TYPE
, encaptype
);
448 addattr16(n
, 1024, IFLA_GRE_ENCAP_FLAGS
, encapflags
);
449 addattr16(n
, 1024, IFLA_GRE_ENCAP_SPORT
, htons(encapsport
));
450 addattr16(n
, 1024, IFLA_GRE_ENCAP_DPORT
, htons(encapdport
));
455 static void gre_print_opt(struct link_util
*lu
, FILE *f
, struct rtattr
*tb
[])
467 if (tb
[IFLA_GRE_COLLECT_METADATA
]) {
468 print_bool(PRINT_ANY
, "external", "external", true);
472 if (tb
[IFLA_GRE_FLAGS
])
473 flags
= rta_getattr_u32(tb
[IFLA_GRE_FLAGS
]);
475 if (tb
[IFLA_GRE_FLOWINFO
])
476 flowinfo
= rta_getattr_u32(tb
[IFLA_GRE_FLOWINFO
]);
478 tnl_print_endpoint("remote", tb
[IFLA_GRE_REMOTE
], AF_INET6
);
479 tnl_print_endpoint("local", tb
[IFLA_GRE_LOCAL
], AF_INET6
);
481 if (tb
[IFLA_GRE_LINK
]) {
482 __u32 link
= rta_getattr_u32(tb
[IFLA_GRE_LINK
]);
485 print_string(PRINT_ANY
, "link", "dev %s ",
486 ll_index_to_name(link
));
490 if (tb
[IFLA_GRE_TTL
])
491 ttl
= rta_getattr_u8(tb
[IFLA_GRE_TTL
]);
492 if (is_json_context() || ttl
)
493 print_uint(PRINT_ANY
, "ttl", "hoplimit %u ", ttl
);
495 print_string(PRINT_FP
, NULL
, "hoplimit %s ", "inherit");
497 if (flags
& IP6_TNL_F_IGN_ENCAP_LIMIT
) {
498 print_bool(PRINT_ANY
,
499 "ip6_tnl_f_ign_encap_limit",
502 } else if (tb
[IFLA_GRE_ENCAP_LIMIT
]) {
503 __u8 val
= rta_getattr_u8(tb
[IFLA_GRE_ENCAP_LIMIT
]);
505 print_uint(PRINT_ANY
, "encap_limit", "encaplimit %u ", val
);
508 if (flags
& IP6_TNL_F_USE_ORIG_TCLASS
) {
509 print_bool(PRINT_ANY
,
510 "ip6_tnl_f_use_orig_tclass",
513 } else if (tb
[IFLA_GRE_FLOWINFO
]) {
514 __u32 val
= ntohl(flowinfo
& IP6_FLOWINFO_TCLASS
) >> 20;
516 snprintf(s2
, sizeof(s2
), "0x%02x", val
);
517 print_string(PRINT_ANY
, "tclass", "tclass %s ", s2
);
520 if (flags
& IP6_TNL_F_USE_ORIG_FLOWLABEL
) {
521 print_bool(PRINT_ANY
,
522 "ip6_tnl_f_use_orig_flowlabel",
523 "flowlabel inherit ",
525 } else if (tb
[IFLA_GRE_FLOWINFO
]) {
526 __u32 val
= ntohl(flowinfo
& IP6_FLOWINFO_FLOWLABEL
);
528 snprintf(s2
, sizeof(s2
), "0x%05x", val
);
529 print_string(PRINT_ANY
, "flowlabel", "flowlabel %s ", s2
);
532 if (flags
& IP6_TNL_F_RCV_DSCP_COPY
)
533 print_bool(PRINT_ANY
,
534 "ip6_tnl_f_rcv_dscp_copy",
538 if (tb
[IFLA_GRE_IFLAGS
])
539 iflags
= rta_getattr_u16(tb
[IFLA_GRE_IFLAGS
]);
541 if (tb
[IFLA_GRE_OFLAGS
])
542 oflags
= rta_getattr_u16(tb
[IFLA_GRE_OFLAGS
]);
544 if ((iflags
& GRE_KEY
) && tb
[IFLA_GRE_IKEY
]) {
545 inet_ntop(AF_INET
, RTA_DATA(tb
[IFLA_GRE_IKEY
]), s2
, sizeof(s2
));
546 print_string(PRINT_ANY
, "ikey", "ikey %s ", s2
);
549 if ((oflags
& GRE_KEY
) && tb
[IFLA_GRE_OKEY
]) {
550 inet_ntop(AF_INET
, RTA_DATA(tb
[IFLA_GRE_OKEY
]), s2
, sizeof(s2
));
551 print_string(PRINT_ANY
, "okey", "okey %s ", s2
);
554 if (iflags
& GRE_SEQ
)
555 print_bool(PRINT_ANY
, "iseq", "iseq ", true);
556 if (oflags
& GRE_SEQ
)
557 print_bool(PRINT_ANY
, "oseq", "oseq ", true);
558 if (iflags
& GRE_CSUM
)
559 print_bool(PRINT_ANY
, "icsum", "icsum ", true);
560 if (oflags
& GRE_CSUM
)
561 print_bool(PRINT_ANY
, "ocsum", "ocsum ", true);
563 if (flags
& IP6_TNL_F_ALLOW_LOCAL_REMOTE
)
564 print_bool(PRINT_ANY
,
565 "ip6_tnl_f_allow_local_remote",
566 "allow-localremote ",
569 if (flags
& IP6_TNL_F_USE_ORIG_FWMARK
) {
570 print_bool(PRINT_ANY
,
571 "ip6_tnl_f_use_orig_fwmark",
574 } else if (tb
[IFLA_GRE_FWMARK
]) {
575 __u32 fwmark
= rta_getattr_u32(tb
[IFLA_GRE_FWMARK
]);
578 print_0xhex(PRINT_ANY
,
579 "fwmark", "fwmark 0x%x ", fwmark
);
583 if (tb
[IFLA_GRE_ERSPAN_INDEX
]) {
584 __u32 erspan_idx
= rta_getattr_u32(tb
[IFLA_GRE_ERSPAN_INDEX
]);
586 print_uint(PRINT_ANY
,
587 "erspan_index", "erspan_index %u ", erspan_idx
);
590 if (tb
[IFLA_GRE_ERSPAN_VER
]) {
591 __u8 erspan_ver
= rta_getattr_u8(tb
[IFLA_GRE_ERSPAN_VER
]);
593 print_uint(PRINT_ANY
,
594 "erspan_ver", "erspan_ver %u ", erspan_ver
);
597 if (tb
[IFLA_GRE_ERSPAN_DIR
]) {
598 __u8 erspan_dir
= rta_getattr_u8(tb
[IFLA_GRE_ERSPAN_DIR
]);
601 print_string(PRINT_ANY
, "erspan_dir",
602 "erspan_dir ingress ", NULL
);
604 print_string(PRINT_ANY
, "erspan_dir",
605 "erspan_dir egress ", NULL
);
608 if (tb
[IFLA_GRE_ERSPAN_HWID
]) {
609 __u16 erspan_hwid
= rta_getattr_u16(tb
[IFLA_GRE_ERSPAN_HWID
]);
611 print_0xhex(PRINT_ANY
,
612 "erspan_hwid", "erspan_hwid 0x%x ", erspan_hwid
);
617 IFLA_GRE_ENCAP_FLAGS
,
618 IFLA_GRE_ENCAP_SPORT
,
619 IFLA_GRE_ENCAP_DPORT
);
622 struct link_util ip6gre_link_util
= {
624 .maxattr
= IFLA_GRE_MAX
,
625 .parse_opt
= gre_parse_opt
,
626 .print_opt
= gre_print_opt
,
627 .print_help
= gre_print_help
,
630 struct link_util ip6gretap_link_util
= {
632 .maxattr
= IFLA_GRE_MAX
,
633 .parse_opt
= gre_parse_opt
,
634 .print_opt
= gre_print_opt
,
635 .print_help
= gre_print_help
,
638 struct link_util ip6erspan_link_util
= {
640 .maxattr
= IFLA_GRE_MAX
,
641 .parse_opt
= gre_parse_opt
,
642 .print_opt
= gre_print_opt
,
643 .print_help
= gre_print_help
,