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"
39 " [ [i|o]key KEY | no[i|o]key ]\n"
40 " [ [no][i|o]csum ]\n"
42 " [ encaplimit ELIM ]\n"
43 " [ tclass TCLASS ]\n"
44 " [ flowlabel FLOWLABEL ]\n"
48 " [ [no]allow-localremote ]\n"
51 " [ encap { fou | gue | none } ]\n"
52 " [ encap-sport PORT ]\n"
53 " [ encap-dport PORT ]\n"
54 " [ [no]encap-csum ]\n"
55 " [ [no]encap-csum6 ]\n"
56 " [ [no]encap-remcsum ]\n"
57 " [ erspan_ver version ]\n"
59 " [ erspan_dir { ingress | egress } ]\n"
60 " [ erspan_hwid hwid ]\n"
62 "Where: ADDR := IPV6_ADDRESS\n"
63 " TTL := { 0..255 } (default=%d)\n"
64 " KEY := { DOTTED_QUAD | NUMBER }\n"
65 " ELIM := { none | 0..255 }(default=%d)\n"
66 " TCLASS := { 0x0..0xff | inherit }\n"
67 " FLOWLABEL := { 0x0..0xfffff | inherit }\n"
68 " MARK := { 0x0..0xffffffff | inherit }\n",
70 DEFAULT_TNL_HOP_LIMIT
, IPV6_DEFAULT_TNL_ENCAP_LIMIT
);
73 static int gre_parse_opt(struct link_util
*lu
, int argc
, char **argv
,
76 struct ifinfomsg
*ifi
= NLMSG_DATA(n
);
81 .n
.nlmsg_len
= NLMSG_LENGTH(sizeof(*ifi
)),
82 .n
.nlmsg_flags
= NLM_F_REQUEST
,
83 .n
.nlmsg_type
= RTM_GETLINK
,
84 .i
.ifi_family
= preferred_family
,
85 .i
.ifi_index
= ifi
->ifi_index
,
87 struct nlmsghdr
*answer
;
88 struct rtattr
*tb
[IFLA_MAX
+ 1];
89 struct rtattr
*linkinfo
[IFLA_INFO_MAX
+1];
90 struct rtattr
*greinfo
[IFLA_GRE_MAX
+ 1];
96 inet_prefix saddr
, daddr
;
97 __u8 hop_limit
= DEFAULT_TNL_HOP_LIMIT
;
98 __u8 encap_limit
= IPV6_DEFAULT_TNL_ENCAP_LIMIT
;
103 __u16 encapflags
= TUNNEL_ENCAP_FLAG_CSUM6
;
104 __u16 encapsport
= 0;
105 __u16 encapdport
= 0;
108 __u32 erspan_idx
= 0;
111 __u16 erspan_hwid
= 0;
113 inet_prefix_reset(&saddr
);
114 inet_prefix_reset(&daddr
);
116 if (!(n
->nlmsg_flags
& NLM_F_CREATE
)) {
117 const struct rtattr
*rta
;
119 if (rtnl_talk(&rth
, &req
.n
, &answer
) < 0) {
122 "Failed to get existing tunnel info.\n");
126 len
= answer
->nlmsg_len
;
127 len
-= NLMSG_LENGTH(sizeof(*ifi
));
131 parse_rtattr(tb
, IFLA_MAX
, IFLA_RTA(NLMSG_DATA(answer
)), len
);
133 if (!tb
[IFLA_LINKINFO
])
136 parse_rtattr_nested(linkinfo
, IFLA_INFO_MAX
, tb
[IFLA_LINKINFO
]);
138 if (!linkinfo
[IFLA_INFO_DATA
])
141 parse_rtattr_nested(greinfo
, IFLA_GRE_MAX
,
142 linkinfo
[IFLA_INFO_DATA
]);
144 rta
= greinfo
[IFLA_GRE_LOCAL
];
145 if (rta
&& get_addr_rta(&saddr
, rta
, AF_INET6
))
148 rta
= greinfo
[IFLA_GRE_REMOTE
];
149 if (rta
&& get_addr_rta(&daddr
, rta
, AF_INET6
))
152 if (greinfo
[IFLA_GRE_IKEY
])
153 ikey
= rta_getattr_u32(greinfo
[IFLA_GRE_IKEY
]);
155 if (greinfo
[IFLA_GRE_OKEY
])
156 okey
= rta_getattr_u32(greinfo
[IFLA_GRE_OKEY
]);
158 if (greinfo
[IFLA_GRE_IFLAGS
])
159 iflags
= rta_getattr_u16(greinfo
[IFLA_GRE_IFLAGS
]);
161 if (greinfo
[IFLA_GRE_OFLAGS
])
162 oflags
= rta_getattr_u16(greinfo
[IFLA_GRE_OFLAGS
]);
164 if (greinfo
[IFLA_GRE_TTL
])
165 hop_limit
= rta_getattr_u8(greinfo
[IFLA_GRE_TTL
]);
167 if (greinfo
[IFLA_GRE_LINK
])
168 link
= rta_getattr_u32(greinfo
[IFLA_GRE_LINK
]);
170 if (greinfo
[IFLA_GRE_ENCAP_LIMIT
])
171 encap_limit
= rta_getattr_u8(greinfo
[IFLA_GRE_ENCAP_LIMIT
]);
173 if (greinfo
[IFLA_GRE_FLOWINFO
])
174 flowinfo
= rta_getattr_u32(greinfo
[IFLA_GRE_FLOWINFO
]);
176 if (greinfo
[IFLA_GRE_FLAGS
])
177 flags
= rta_getattr_u32(greinfo
[IFLA_GRE_FLAGS
]);
179 if (greinfo
[IFLA_GRE_ENCAP_TYPE
])
180 encaptype
= rta_getattr_u16(greinfo
[IFLA_GRE_ENCAP_TYPE
]);
182 if (greinfo
[IFLA_GRE_ENCAP_FLAGS
])
183 encapflags
= rta_getattr_u16(greinfo
[IFLA_GRE_ENCAP_FLAGS
]);
185 if (greinfo
[IFLA_GRE_ENCAP_SPORT
])
186 encapsport
= rta_getattr_u16(greinfo
[IFLA_GRE_ENCAP_SPORT
]);
188 if (greinfo
[IFLA_GRE_ENCAP_DPORT
])
189 encapdport
= rta_getattr_u16(greinfo
[IFLA_GRE_ENCAP_DPORT
]);
191 if (greinfo
[IFLA_GRE_COLLECT_METADATA
])
194 if (greinfo
[IFLA_GRE_FWMARK
])
195 fwmark
= rta_getattr_u32(greinfo
[IFLA_GRE_FWMARK
]);
197 if (greinfo
[IFLA_GRE_ERSPAN_INDEX
])
198 erspan_idx
= rta_getattr_u32(greinfo
[IFLA_GRE_ERSPAN_INDEX
]);
200 if (greinfo
[IFLA_GRE_ERSPAN_VER
])
201 erspan_ver
= rta_getattr_u8(greinfo
[IFLA_GRE_ERSPAN_VER
]);
203 if (greinfo
[IFLA_GRE_ERSPAN_DIR
])
204 erspan_dir
= rta_getattr_u8(greinfo
[IFLA_GRE_ERSPAN_DIR
]);
206 if (greinfo
[IFLA_GRE_ERSPAN_HWID
])
207 erspan_hwid
= rta_getattr_u16(greinfo
[IFLA_GRE_ERSPAN_HWID
]);
213 if (!matches(*argv
, "key")) {
217 ikey
= okey
= tnl_parse_key("key", *argv
);
218 } else if (!matches(*argv
, "nokey")) {
222 } else if (!matches(*argv
, "ikey")) {
225 ikey
= tnl_parse_key("ikey", *argv
);
226 } else if (!matches(*argv
, "noikey")) {
229 } else if (!matches(*argv
, "okey")) {
232 okey
= tnl_parse_key("okey", *argv
);
233 } else if (!matches(*argv
, "nookey")) {
236 } else if (!matches(*argv
, "seq")) {
239 } else if (!matches(*argv
, "noseq")) {
242 } else if (!matches(*argv
, "iseq")) {
244 } else if (!matches(*argv
, "noiseq")) {
246 } else if (!matches(*argv
, "oseq")) {
248 } else if (!matches(*argv
, "nooseq")) {
250 } else if (!matches(*argv
, "csum")) {
253 } else if (!matches(*argv
, "nocsum")) {
256 } else if (!matches(*argv
, "icsum")) {
258 } else if (!matches(*argv
, "noicsum")) {
260 } else if (!matches(*argv
, "ocsum")) {
262 } else if (!matches(*argv
, "noocsum")) {
264 } else if (!matches(*argv
, "remote")) {
266 get_addr(&daddr
, *argv
, AF_INET6
);
267 } else if (!matches(*argv
, "local")) {
269 get_addr(&saddr
, *argv
, AF_INET6
);
270 } else if (!matches(*argv
, "dev")) {
272 link
= ll_name_to_index(*argv
);
275 } else if (!matches(*argv
, "ttl") ||
276 !matches(*argv
, "hoplimit") ||
277 !matches(*argv
, "hlim")) {
279 if (strcmp(*argv
, "inherit") != 0) {
280 if (get_u8(&hop_limit
, *argv
, 0))
281 invarg("invalid HLIM\n", *argv
);
284 } else if (!matches(*argv
, "tos") ||
285 !matches(*argv
, "tclass") ||
286 !matches(*argv
, "dsfield")) {
290 flowinfo
&= ~IP6_FLOWINFO_TCLASS
;
291 if (strcmp(*argv
, "inherit") == 0)
292 flags
|= IP6_TNL_F_USE_ORIG_TCLASS
;
294 if (get_u8(&uval
, *argv
, 16))
295 invarg("invalid TClass", *argv
);
296 flowinfo
|= htonl((__u32
)uval
<< 20) & IP6_FLOWINFO_TCLASS
;
297 flags
&= ~IP6_TNL_F_USE_ORIG_TCLASS
;
299 } else if (strcmp(*argv
, "flowlabel") == 0 ||
300 strcmp(*argv
, "fl") == 0) {
304 flowinfo
&= ~IP6_FLOWINFO_FLOWLABEL
;
305 if (strcmp(*argv
, "inherit") == 0)
306 flags
|= IP6_TNL_F_USE_ORIG_FLOWLABEL
;
308 if (get_u32(&uval
, *argv
, 16))
309 invarg("invalid Flowlabel", *argv
);
311 invarg("invalid Flowlabel", *argv
);
312 flowinfo
|= htonl(uval
) & IP6_FLOWINFO_FLOWLABEL
;
313 flags
&= ~IP6_TNL_F_USE_ORIG_FLOWLABEL
;
315 } else if (strcmp(*argv
, "dscp") == 0) {
317 if (strcmp(*argv
, "inherit") != 0)
318 invarg("not inherit", *argv
);
319 flags
|= IP6_TNL_F_RCV_DSCP_COPY
;
320 } else if (strcmp(*argv
, "noencap") == 0) {
321 encaptype
= TUNNEL_ENCAP_NONE
;
322 } else if (strcmp(*argv
, "encap") == 0) {
324 if (strcmp(*argv
, "fou") == 0)
325 encaptype
= TUNNEL_ENCAP_FOU
;
326 else if (strcmp(*argv
, "gue") == 0)
327 encaptype
= TUNNEL_ENCAP_GUE
;
328 else if (strcmp(*argv
, "none") == 0)
329 encaptype
= TUNNEL_ENCAP_NONE
;
331 invarg("Invalid encap type.", *argv
);
332 } else if (strcmp(*argv
, "encap-sport") == 0) {
334 if (strcmp(*argv
, "auto") == 0)
336 else if (get_u16(&encapsport
, *argv
, 0))
337 invarg("Invalid source port.", *argv
);
338 } else if (strcmp(*argv
, "encap-dport") == 0) {
340 if (get_u16(&encapdport
, *argv
, 0))
341 invarg("Invalid destination port.", *argv
);
342 } else if (strcmp(*argv
, "encap-csum") == 0) {
343 encapflags
|= TUNNEL_ENCAP_FLAG_CSUM
;
344 } else if (strcmp(*argv
, "noencap-csum") == 0) {
345 encapflags
&= ~TUNNEL_ENCAP_FLAG_CSUM
;
346 } else if (strcmp(*argv
, "encap-udp6-csum") == 0) {
347 encapflags
|= TUNNEL_ENCAP_FLAG_CSUM6
;
348 } else if (strcmp(*argv
, "noencap-udp6-csum") == 0) {
349 encapflags
&= ~TUNNEL_ENCAP_FLAG_CSUM6
;
350 } else if (strcmp(*argv
, "encap-remcsum") == 0) {
351 encapflags
|= TUNNEL_ENCAP_FLAG_REMCSUM
;
352 } else if (strcmp(*argv
, "noencap-remcsum") == 0) {
353 encapflags
&= ~TUNNEL_ENCAP_FLAG_REMCSUM
;
354 } else if (strcmp(*argv
, "external") == 0) {
356 } else if (strcmp(*argv
, "fwmark") == 0) {
358 if (strcmp(*argv
, "inherit") == 0) {
359 flags
|= IP6_TNL_F_USE_ORIG_FWMARK
;
362 if (get_u32(&fwmark
, *argv
, 0))
363 invarg("invalid fwmark\n", *argv
);
364 flags
&= ~IP6_TNL_F_USE_ORIG_FWMARK
;
366 } else if (strcmp(*argv
, "allow-localremote") == 0) {
367 flags
|= IP6_TNL_F_ALLOW_LOCAL_REMOTE
;
368 } else if (strcmp(*argv
, "noallow-localremote") == 0) {
369 flags
&= ~IP6_TNL_F_ALLOW_LOCAL_REMOTE
;
370 } else if (strcmp(*argv
, "encaplimit") == 0) {
372 if (strcmp(*argv
, "none") == 0) {
373 flags
|= IP6_TNL_F_IGN_ENCAP_LIMIT
;
377 if (get_u8(&uval
, *argv
, 0))
378 invarg("invalid ELIM", *argv
);
380 flags
&= ~IP6_TNL_F_IGN_ENCAP_LIMIT
;
382 } else if (strcmp(*argv
, "erspan") == 0) {
384 if (get_u32(&erspan_idx
, *argv
, 0))
385 invarg("invalid erspan index\n", *argv
);
386 if (erspan_idx
& ~((1<<20) - 1) || erspan_idx
== 0)
387 invarg("erspan index must be > 0 and <= 20-bit\n", *argv
);
388 } else if (strcmp(*argv
, "erspan_ver") == 0) {
390 if (get_u8(&erspan_ver
, *argv
, 0))
391 invarg("invalid erspan version\n", *argv
);
393 invarg("erspan version must be 0/1/2\n", *argv
);
394 } else if (strcmp(*argv
, "erspan_dir") == 0) {
396 if (matches(*argv
, "ingress") == 0)
398 else if (matches(*argv
, "egress") == 0)
401 invarg("Invalid erspan direction.", *argv
);
402 } else if (strcmp(*argv
, "erspan_hwid") == 0) {
404 if (get_u16(&erspan_hwid
, *argv
, 0))
405 invarg("invalid erspan hwid\n", *argv
);
407 gre_print_help(lu
, argc
, argv
, stderr
);
414 addattr_l(n
, 1024, IFLA_GRE_COLLECT_METADATA
, NULL
, 0);
418 addattr32(n
, 1024, IFLA_GRE_IKEY
, ikey
);
419 addattr32(n
, 1024, IFLA_GRE_OKEY
, okey
);
420 addattr_l(n
, 1024, IFLA_GRE_IFLAGS
, &iflags
, 2);
421 addattr_l(n
, 1024, IFLA_GRE_OFLAGS
, &oflags
, 2);
422 if (is_addrtype_inet_not_unspec(&saddr
))
423 addattr_l(n
, 1024, IFLA_GRE_LOCAL
, saddr
.data
, saddr
.bytelen
);
424 if (is_addrtype_inet_not_unspec(&daddr
))
425 addattr_l(n
, 1024, IFLA_GRE_REMOTE
, daddr
.data
, daddr
.bytelen
);
427 addattr32(n
, 1024, IFLA_GRE_LINK
, link
);
428 addattr_l(n
, 1024, IFLA_GRE_TTL
, &hop_limit
, 1);
429 addattr_l(n
, 1024, IFLA_GRE_ENCAP_LIMIT
, &encap_limit
, 1);
430 addattr_l(n
, 1024, IFLA_GRE_FLOWINFO
, &flowinfo
, 4);
431 addattr32(n
, 1024, IFLA_GRE_FLAGS
, flags
);
432 addattr32(n
, 1024, IFLA_GRE_FWMARK
, fwmark
);
433 if (erspan_ver
<= 2) {
434 addattr8(n
, 1024, IFLA_GRE_ERSPAN_VER
, erspan_ver
);
435 if (erspan_ver
== 1 && erspan_idx
!= 0) {
436 addattr32(n
, 1024, IFLA_GRE_ERSPAN_INDEX
, erspan_idx
);
437 } else if (erspan_ver
== 2) {
438 addattr8(n
, 1024, IFLA_GRE_ERSPAN_DIR
, erspan_dir
);
439 addattr16(n
, 1024, IFLA_GRE_ERSPAN_HWID
, erspan_hwid
);
442 addattr16(n
, 1024, IFLA_GRE_ENCAP_TYPE
, encaptype
);
443 addattr16(n
, 1024, IFLA_GRE_ENCAP_FLAGS
, encapflags
);
444 addattr16(n
, 1024, IFLA_GRE_ENCAP_SPORT
, htons(encapsport
));
445 addattr16(n
, 1024, IFLA_GRE_ENCAP_DPORT
, htons(encapdport
));
450 static void gre_print_opt(struct link_util
*lu
, FILE *f
, struct rtattr
*tb
[])
462 if (tb
[IFLA_GRE_COLLECT_METADATA
]) {
463 print_bool(PRINT_ANY
, "external", "external ", true);
467 if (tb
[IFLA_GRE_FLAGS
])
468 flags
= rta_getattr_u32(tb
[IFLA_GRE_FLAGS
]);
470 if (tb
[IFLA_GRE_FLOWINFO
])
471 flowinfo
= rta_getattr_u32(tb
[IFLA_GRE_FLOWINFO
]);
473 tnl_print_endpoint("remote", tb
[IFLA_GRE_REMOTE
], AF_INET6
);
474 tnl_print_endpoint("local", tb
[IFLA_GRE_LOCAL
], AF_INET6
);
476 if (tb
[IFLA_GRE_LINK
]) {
477 __u32 link
= rta_getattr_u32(tb
[IFLA_GRE_LINK
]);
480 print_string(PRINT_ANY
, "link", "dev %s ",
481 ll_index_to_name(link
));
485 if (tb
[IFLA_GRE_TTL
])
486 ttl
= rta_getattr_u8(tb
[IFLA_GRE_TTL
]);
487 if (is_json_context() || ttl
)
488 print_uint(PRINT_ANY
, "ttl", "hoplimit %u ", ttl
);
490 print_string(PRINT_FP
, NULL
, "hoplimit %s ", "inherit");
492 if (flags
& IP6_TNL_F_IGN_ENCAP_LIMIT
) {
493 print_bool(PRINT_ANY
,
494 "ip6_tnl_f_ign_encap_limit",
497 } else if (tb
[IFLA_GRE_ENCAP_LIMIT
]) {
498 __u8 val
= rta_getattr_u8(tb
[IFLA_GRE_ENCAP_LIMIT
]);
500 print_uint(PRINT_ANY
, "encap_limit", "encaplimit %u ", val
);
503 if (flags
& IP6_TNL_F_USE_ORIG_TCLASS
) {
504 print_bool(PRINT_ANY
,
505 "ip6_tnl_f_use_orig_tclass",
508 } else if (tb
[IFLA_GRE_FLOWINFO
]) {
509 __u32 val
= ntohl(flowinfo
& IP6_FLOWINFO_TCLASS
) >> 20;
511 snprintf(s2
, sizeof(s2
), "0x%02x", val
);
512 print_string(PRINT_ANY
, "tclass", "tclass %s ", s2
);
515 if (flags
& IP6_TNL_F_USE_ORIG_FLOWLABEL
) {
516 print_bool(PRINT_ANY
,
517 "ip6_tnl_f_use_orig_flowlabel",
518 "flowlabel inherit ",
520 } else if (tb
[IFLA_GRE_FLOWINFO
]) {
521 __u32 val
= ntohl(flowinfo
& IP6_FLOWINFO_FLOWLABEL
);
523 snprintf(s2
, sizeof(s2
), "0x%05x", val
);
524 print_string(PRINT_ANY
, "flowlabel", "flowlabel %s ", s2
);
527 if (flags
& IP6_TNL_F_RCV_DSCP_COPY
)
528 print_bool(PRINT_ANY
,
529 "ip6_tnl_f_rcv_dscp_copy",
533 if (tb
[IFLA_GRE_IFLAGS
])
534 iflags
= rta_getattr_u16(tb
[IFLA_GRE_IFLAGS
]);
536 if (tb
[IFLA_GRE_OFLAGS
])
537 oflags
= rta_getattr_u16(tb
[IFLA_GRE_OFLAGS
]);
539 if ((iflags
& GRE_KEY
) && tb
[IFLA_GRE_IKEY
]) {
540 inet_ntop(AF_INET
, RTA_DATA(tb
[IFLA_GRE_IKEY
]), s2
, sizeof(s2
));
541 print_string(PRINT_ANY
, "ikey", "ikey %s ", s2
);
544 if ((oflags
& GRE_KEY
) && tb
[IFLA_GRE_OKEY
]) {
545 inet_ntop(AF_INET
, RTA_DATA(tb
[IFLA_GRE_OKEY
]), s2
, sizeof(s2
));
546 print_string(PRINT_ANY
, "okey", "okey %s ", s2
);
549 if (iflags
& GRE_SEQ
)
550 print_bool(PRINT_ANY
, "iseq", "iseq ", true);
551 if (oflags
& GRE_SEQ
)
552 print_bool(PRINT_ANY
, "oseq", "oseq ", true);
553 if (iflags
& GRE_CSUM
)
554 print_bool(PRINT_ANY
, "icsum", "icsum ", true);
555 if (oflags
& GRE_CSUM
)
556 print_bool(PRINT_ANY
, "ocsum", "ocsum ", true);
558 if (flags
& IP6_TNL_F_ALLOW_LOCAL_REMOTE
)
559 print_bool(PRINT_ANY
,
560 "ip6_tnl_f_allow_local_remote",
561 "allow-localremote ",
564 if (flags
& IP6_TNL_F_USE_ORIG_FWMARK
) {
565 print_bool(PRINT_ANY
,
566 "ip6_tnl_f_use_orig_fwmark",
569 } else if (tb
[IFLA_GRE_FWMARK
]) {
570 __u32 fwmark
= rta_getattr_u32(tb
[IFLA_GRE_FWMARK
]);
573 print_0xhex(PRINT_ANY
,
574 "fwmark", "fwmark %#llx ", fwmark
);
578 if (tb
[IFLA_GRE_ERSPAN_INDEX
]) {
579 __u32 erspan_idx
= rta_getattr_u32(tb
[IFLA_GRE_ERSPAN_INDEX
]);
581 print_uint(PRINT_ANY
,
582 "erspan_index", "erspan_index %u ", erspan_idx
);
585 if (tb
[IFLA_GRE_ERSPAN_VER
]) {
586 __u8 erspan_ver
= rta_getattr_u8(tb
[IFLA_GRE_ERSPAN_VER
]);
588 print_uint(PRINT_ANY
,
589 "erspan_ver", "erspan_ver %u ", erspan_ver
);
592 if (tb
[IFLA_GRE_ERSPAN_DIR
]) {
593 __u8 erspan_dir
= rta_getattr_u8(tb
[IFLA_GRE_ERSPAN_DIR
]);
596 print_string(PRINT_ANY
, "erspan_dir",
597 "erspan_dir ingress ", NULL
);
599 print_string(PRINT_ANY
, "erspan_dir",
600 "erspan_dir egress ", NULL
);
603 if (tb
[IFLA_GRE_ERSPAN_HWID
]) {
604 __u16 erspan_hwid
= rta_getattr_u16(tb
[IFLA_GRE_ERSPAN_HWID
]);
606 print_0xhex(PRINT_ANY
,
607 "erspan_hwid", "erspan_hwid %#llx ", erspan_hwid
);
612 IFLA_GRE_ENCAP_FLAGS
,
613 IFLA_GRE_ENCAP_SPORT
,
614 IFLA_GRE_ENCAP_DPORT
);
617 struct link_util ip6gre_link_util
= {
619 .maxattr
= IFLA_GRE_MAX
,
620 .parse_opt
= gre_parse_opt
,
621 .print_opt
= gre_print_opt
,
622 .print_help
= gre_print_help
,
625 struct link_util ip6gretap_link_util
= {
627 .maxattr
= IFLA_GRE_MAX
,
628 .parse_opt
= gre_parse_opt
,
629 .print_opt
= gre_print_opt
,
630 .print_help
= gre_print_help
,
633 struct link_util ip6erspan_link_util
= {
635 .maxattr
= IFLA_GRE_MAX
,
636 .parse_opt
= gre_parse_opt
,
637 .print_opt
= gre_print_opt
,
638 .print_help
= gre_print_help
,