]> git.proxmox.com Git - mirror_iproute2.git/blob - ip/iptunnel.c
ip{,6}tunnel: put spaces around non-unary operators
[mirror_iproute2.git] / ip / iptunnel.c
1 /*
2 * iptunnel.c "ip tunnel"
3 *
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.
8 *
9 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
10 *
11 */
12
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <string.h>
16 #include <unistd.h>
17 #include <sys/types.h>
18 #include <sys/socket.h>
19 #include <arpa/inet.h>
20 #include <sys/ioctl.h>
21 #include <net/if.h>
22 #include <net/if_arp.h>
23 #include <linux/ip.h>
24 #include <linux/if_tunnel.h>
25
26 #include "rt_names.h"
27 #include "utils.h"
28 #include "ip_common.h"
29 #include "tunnel.h"
30
31 static void usage(void) __attribute__((noreturn));
32
33 static void usage(void)
34 {
35 fprintf(stderr, "Usage: ip tunnel { add | change | del | show | prl | 6rd } [ NAME ]\n");
36 fprintf(stderr, " [ mode { ipip | gre | sit | isatap | vti } ] [ remote ADDR ] [ local ADDR ]\n");
37 fprintf(stderr, " [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum ]\n");
38 fprintf(stderr, " [ prl-default ADDR ] [ prl-nodefault ADDR ] [ prl-delete ADDR ]\n");
39 fprintf(stderr, " [ 6rd-prefix ADDR ] [ 6rd-relay_prefix ADDR ] [ 6rd-reset ]\n");
40 fprintf(stderr, " [ ttl TTL ] [ tos TOS ] [ [no]pmtudisc ] [ dev PHYS_DEV ]\n");
41 fprintf(stderr, "\n");
42 fprintf(stderr, "Where: NAME := STRING\n");
43 fprintf(stderr, " ADDR := { IP_ADDRESS | any }\n");
44 fprintf(stderr, " TOS := { STRING | 00..ff | inherit | inherit/STRING | inherit/00..ff }\n");
45 fprintf(stderr, " TTL := { 1..255 | inherit }\n");
46 fprintf(stderr, " KEY := { DOTTED_QUAD | NUMBER }\n");
47 exit(-1);
48 }
49
50 static void set_tunnel_proto(struct ip_tunnel_parm *p, int proto)
51 {
52 if (p->iph.protocol && p->iph.protocol != proto) {
53 fprintf(stderr,"You managed to ask for more than one tunnel mode.\n");
54 exit(-1);
55 }
56 p->iph.protocol = proto;
57 }
58
59 static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
60 {
61 int count = 0;
62 char medium[IFNAMSIZ];
63 int isatap = 0;
64
65 memset(p, 0, sizeof(*p));
66 memset(&medium, 0, sizeof(medium));
67
68 p->iph.version = 4;
69 p->iph.ihl = 5;
70 #ifndef IP_DF
71 #define IP_DF 0x4000 /* Flag: "Don't Fragment" */
72 #endif
73 p->iph.frag_off = htons(IP_DF);
74
75 while (argc > 0) {
76 if (strcmp(*argv, "mode") == 0) {
77 NEXT_ARG();
78 if (strcmp(*argv, "ipip") == 0 ||
79 strcmp(*argv, "ip/ip") == 0) {
80 set_tunnel_proto(p, IPPROTO_IPIP);
81 } else if (strcmp(*argv, "gre") == 0 ||
82 strcmp(*argv, "gre/ip") == 0) {
83 set_tunnel_proto(p, IPPROTO_GRE);
84 } else if (strcmp(*argv, "sit") == 0 ||
85 strcmp(*argv, "ipv6/ip") == 0) {
86 set_tunnel_proto(p, IPPROTO_IPV6);
87 } else if (strcmp(*argv, "isatap") == 0) {
88 set_tunnel_proto(p, IPPROTO_IPV6);
89 isatap++;
90 } else if (strcmp(*argv, "vti") == 0) {
91 set_tunnel_proto(p, IPPROTO_IPIP);
92 p->i_flags |= VTI_ISVTI;
93 } else {
94 fprintf(stderr,"Unknown tunnel mode \"%s\"\n", *argv);
95 exit(-1);
96 }
97 } else if (strcmp(*argv, "key") == 0) {
98 NEXT_ARG();
99 p->i_flags |= GRE_KEY;
100 p->o_flags |= GRE_KEY;
101 p->i_key = p->o_key = tnl_parse_key("key", *argv);
102 } else if (strcmp(*argv, "ikey") == 0) {
103 NEXT_ARG();
104 p->i_flags |= GRE_KEY;
105 p->i_key = tnl_parse_key("ikey", *argv);
106 } else if (strcmp(*argv, "okey") == 0) {
107 NEXT_ARG();
108 p->o_flags |= GRE_KEY;
109 p->o_key = tnl_parse_key("okey", *argv);
110 } else if (strcmp(*argv, "seq") == 0) {
111 p->i_flags |= GRE_SEQ;
112 p->o_flags |= GRE_SEQ;
113 } else if (strcmp(*argv, "iseq") == 0) {
114 p->i_flags |= GRE_SEQ;
115 } else if (strcmp(*argv, "oseq") == 0) {
116 p->o_flags |= GRE_SEQ;
117 } else if (strcmp(*argv, "csum") == 0) {
118 p->i_flags |= GRE_CSUM;
119 p->o_flags |= GRE_CSUM;
120 } else if (strcmp(*argv, "icsum") == 0) {
121 p->i_flags |= GRE_CSUM;
122 } else if (strcmp(*argv, "ocsum") == 0) {
123 p->o_flags |= GRE_CSUM;
124 } else if (strcmp(*argv, "nopmtudisc") == 0) {
125 p->iph.frag_off = 0;
126 } else if (strcmp(*argv, "pmtudisc") == 0) {
127 p->iph.frag_off = htons(IP_DF);
128 } else if (strcmp(*argv, "remote") == 0) {
129 NEXT_ARG();
130 if (strcmp(*argv, "any"))
131 p->iph.daddr = get_addr32(*argv);
132 else
133 p->iph.daddr = htonl(INADDR_ANY);
134 } else if (strcmp(*argv, "local") == 0) {
135 NEXT_ARG();
136 if (strcmp(*argv, "any"))
137 p->iph.saddr = get_addr32(*argv);
138 else
139 p->iph.saddr = htonl(INADDR_ANY);
140 } else if (strcmp(*argv, "dev") == 0) {
141 NEXT_ARG();
142 strncpy(medium, *argv, IFNAMSIZ - 1);
143 } else if (strcmp(*argv, "ttl") == 0 ||
144 strcmp(*argv, "hoplimit") == 0 ||
145 strcmp(*argv, "hlim") == 0) {
146 __u8 uval;
147 NEXT_ARG();
148 if (strcmp(*argv, "inherit") != 0) {
149 if (get_u8(&uval, *argv, 0))
150 invarg("invalid TTL\n", *argv);
151 p->iph.ttl = uval;
152 }
153 } else if (strcmp(*argv, "tos") == 0 ||
154 strcmp(*argv, "tclass") == 0 ||
155 matches(*argv, "dsfield") == 0) {
156 char *dsfield;
157 __u32 uval;
158 NEXT_ARG();
159 dsfield = *argv;
160 strsep(&dsfield, "/");
161 if (strcmp(*argv, "inherit") != 0) {
162 dsfield = *argv;
163 p->iph.tos = 0;
164 } else
165 p->iph.tos = 1;
166 if (dsfield) {
167 if (rtnl_dsfield_a2n(&uval, dsfield))
168 invarg("bad TOS value", *argv);
169 p->iph.tos |= uval;
170 }
171 } else {
172 if (strcmp(*argv, "name") == 0) {
173 NEXT_ARG();
174 } else if (matches(*argv, "help") == 0)
175 usage();
176 if (p->name[0])
177 duparg2("name", *argv);
178 strncpy(p->name, *argv, IFNAMSIZ - 1);
179 if (cmd == SIOCCHGTUNNEL && count == 0) {
180 struct ip_tunnel_parm old_p;
181 memset(&old_p, 0, sizeof(old_p));
182 if (tnl_get_ioctl(*argv, &old_p))
183 return -1;
184 *p = old_p;
185 }
186 }
187 count++;
188 argc--; argv++;
189 }
190
191
192 if (p->iph.protocol == 0) {
193 if (memcmp(p->name, "gre", 3) == 0)
194 p->iph.protocol = IPPROTO_GRE;
195 else if (memcmp(p->name, "ipip", 4) == 0)
196 p->iph.protocol = IPPROTO_IPIP;
197 else if (memcmp(p->name, "sit", 3) == 0)
198 p->iph.protocol = IPPROTO_IPV6;
199 else if (memcmp(p->name, "isatap", 6) == 0) {
200 p->iph.protocol = IPPROTO_IPV6;
201 isatap++;
202 } else if (memcmp(p->name, "vti", 3) == 0) {
203 p->iph.protocol = IPPROTO_IPIP;
204 p->i_flags |= VTI_ISVTI;
205 }
206 }
207
208 if ((p->i_flags & GRE_KEY) || (p->o_flags & GRE_KEY)) {
209 if (!(p->i_flags & VTI_ISVTI) &&
210 (p->iph.protocol != IPPROTO_GRE)) {
211 fprintf(stderr, "Keys are not allowed with ipip and sit tunnels\n");
212 return -1;
213 }
214 }
215
216 if (medium[0]) {
217 p->link = ll_name_to_index(medium);
218 if (p->link == 0) {
219 fprintf(stderr, "Cannot find device \"%s\"\n", medium);
220 return -1;
221 }
222 }
223
224 if (p->i_key == 0 && IN_MULTICAST(ntohl(p->iph.daddr))) {
225 p->i_key = p->iph.daddr;
226 p->i_flags |= GRE_KEY;
227 }
228 if (p->o_key == 0 && IN_MULTICAST(ntohl(p->iph.daddr))) {
229 p->o_key = p->iph.daddr;
230 p->o_flags |= GRE_KEY;
231 }
232 if (IN_MULTICAST(ntohl(p->iph.daddr)) && !p->iph.saddr) {
233 fprintf(stderr, "A broadcast tunnel requires a source address\n");
234 return -1;
235 }
236 if (isatap)
237 p->i_flags |= SIT_ISATAP;
238
239 return 0;
240 }
241
242 static const char *tnl_defname(const struct ip_tunnel_parm *p)
243 {
244 switch (p->iph.protocol) {
245 case IPPROTO_IPIP:
246 if (p->i_flags & VTI_ISVTI)
247 return "ip_vti0";
248 else
249 return "tunl0";
250 case IPPROTO_GRE:
251 return "gre0";
252 case IPPROTO_IPV6:
253 return "sit0";
254 }
255 return NULL;
256 }
257
258 static int do_add(int cmd, int argc, char **argv)
259 {
260 struct ip_tunnel_parm p;
261 const char *basedev;
262
263 if (parse_args(argc, argv, cmd, &p) < 0)
264 return -1;
265
266 if (p.iph.ttl && p.iph.frag_off == 0) {
267 fprintf(stderr, "ttl != 0 and nopmtudisc are incompatible\n");
268 return -1;
269 }
270
271 if (!(basedev = tnl_defname(&p))) {
272 fprintf(stderr, "cannot determine tunnel mode (ipip, gre, vti or sit)\n");
273 return -1;
274 }
275
276 return tnl_add_ioctl(cmd, basedev, p.name, &p);
277 }
278
279 static int do_del(int argc, char **argv)
280 {
281 struct ip_tunnel_parm p;
282
283 if (parse_args(argc, argv, SIOCDELTUNNEL, &p) < 0)
284 return -1;
285
286 return tnl_del_ioctl(tnl_defname(&p) ? : p.name, p.name, &p);
287 }
288
289 static void print_tunnel(struct ip_tunnel_parm *p)
290 {
291 struct ip_tunnel_6rd ip6rd;
292 char s1[1024];
293 char s2[1024];
294
295 memset(&ip6rd, 0, sizeof(ip6rd));
296
297 /* Do not use format_host() for local addr,
298 * symbolic name will not be useful.
299 */
300 printf("%s: %s/ip remote %s local %s",
301 p->name,
302 tnl_strproto(p->iph.protocol),
303 p->iph.daddr ? format_host(AF_INET, 4, &p->iph.daddr, s1, sizeof(s1)) : "any",
304 p->iph.saddr ? rt_addr_n2a(AF_INET, 4, &p->iph.saddr, s2, sizeof(s2)) : "any");
305
306 if (p->iph.protocol == IPPROTO_IPV6 && (p->i_flags & SIT_ISATAP)) {
307 struct ip_tunnel_prl prl[16];
308 int i;
309
310 memset(prl, 0, sizeof(prl));
311 prl[0].datalen = sizeof(prl) - sizeof(prl[0]);
312 prl[0].addr = htonl(INADDR_ANY);
313
314 if (!tnl_prl_ioctl(SIOCGETPRL, p->name, prl))
315 for (i = 1; i < sizeof(prl) / sizeof(prl[0]); i++)
316 {
317 if (prl[i].addr != htonl(INADDR_ANY)) {
318 printf(" %s %s ",
319 (prl[i].flags & PRL_DEFAULT) ? "pdr" : "pr",
320 format_host(AF_INET, 4, &prl[i].addr, s1, sizeof(s1)));
321 }
322 }
323 }
324
325 if (p->link) {
326 const char *n = ll_index_to_name(p->link);
327 if (n)
328 printf(" dev %s", n);
329 }
330
331 if (p->iph.ttl)
332 printf(" ttl %d", p->iph.ttl);
333 else
334 printf(" ttl inherit");
335
336 if (p->iph.tos) {
337 SPRINT_BUF(b1);
338 printf(" tos");
339 if (p->iph.tos & 1)
340 printf(" inherit");
341 if (p->iph.tos & ~1)
342 printf("%c%s ", p->iph.tos & 1 ? '/' : ' ',
343 rtnl_dsfield_n2a(p->iph.tos & ~1, b1, sizeof(b1)));
344 }
345
346 if (!(p->iph.frag_off & htons(IP_DF)))
347 printf(" nopmtudisc");
348
349 if (p->iph.protocol == IPPROTO_IPV6 && !tnl_ioctl_get_6rd(p->name, &ip6rd) && ip6rd.prefixlen) {
350 printf(" 6rd-prefix %s/%u",
351 inet_ntop(AF_INET6, &ip6rd.prefix, s1, sizeof(s1)),
352 ip6rd.prefixlen);
353 if (ip6rd.relay_prefix) {
354 printf(" 6rd-relay_prefix %s/%u",
355 format_host(AF_INET, 4, &ip6rd.relay_prefix, s1, sizeof(s1)),
356 ip6rd.relay_prefixlen);
357 }
358 }
359
360 if ((p->i_flags & GRE_KEY) && (p->o_flags & GRE_KEY) && p->o_key == p->i_key)
361 printf(" key %u", ntohl(p->i_key));
362 else if ((p->i_flags | p->o_flags) & GRE_KEY) {
363 if (p->i_flags & GRE_KEY)
364 printf(" ikey %u", ntohl(p->i_key));
365 if (p->o_flags & GRE_KEY)
366 printf(" okey %u", ntohl(p->o_key));
367 }
368
369 if (p->i_flags & GRE_SEQ)
370 printf("%s Drop packets out of sequence.", _SL_);
371 if (p->i_flags & GRE_CSUM)
372 printf("%s Checksum in received packet is required.", _SL_);
373 if (p->o_flags & GRE_SEQ)
374 printf("%s Sequence packets on output.", _SL_);
375 if (p->o_flags & GRE_CSUM)
376 printf("%s Checksum output packets.", _SL_);
377 }
378
379 static int do_tunnels_list(struct ip_tunnel_parm *p)
380 {
381 char buf[512];
382 int err = -1;
383 FILE *fp = fopen("/proc/net/dev", "r");
384 if (fp == NULL) {
385 perror("fopen");
386 return -1;
387 }
388
389 /* skip header lines */
390 if (!fgets(buf, sizeof(buf), fp) ||
391 !fgets(buf, sizeof(buf), fp)) {
392 fprintf(stderr, "/proc/net/dev read error\n");
393 goto end;
394 }
395
396 while (fgets(buf, sizeof(buf), fp) != NULL) {
397 char name[IFNAMSIZ];
398 int index, type;
399 unsigned long rx_bytes, rx_packets, rx_errs, rx_drops,
400 rx_fifo, rx_frame,
401 tx_bytes, tx_packets, tx_errs, tx_drops,
402 tx_fifo, tx_colls, tx_carrier, rx_multi;
403 struct ip_tunnel_parm p1;
404 char *ptr;
405
406 buf[sizeof(buf) - 1] = 0;
407 if ((ptr = strchr(buf, ':')) == NULL ||
408 (*ptr++ = 0, sscanf(buf, "%s", name) != 1)) {
409 fprintf(stderr, "Wrong format for /proc/net/dev. Giving up.\n");
410 goto end;
411 }
412 if (sscanf(ptr, "%ld%ld%ld%ld%ld%ld%ld%*d%ld%ld%ld%ld%ld%ld%ld",
413 &rx_bytes, &rx_packets, &rx_errs, &rx_drops,
414 &rx_fifo, &rx_frame, &rx_multi,
415 &tx_bytes, &tx_packets, &tx_errs, &tx_drops,
416 &tx_fifo, &tx_colls, &tx_carrier) != 14)
417 continue;
418 if (p->name[0] && strcmp(p->name, name))
419 continue;
420 index = ll_name_to_index(name);
421 if (index == 0)
422 continue;
423 type = ll_index_to_type(index);
424 if (type == -1) {
425 fprintf(stderr, "Failed to get type of \"%s\"\n", name);
426 continue;
427 }
428 if (type != ARPHRD_TUNNEL && type != ARPHRD_IPGRE && type != ARPHRD_SIT)
429 continue;
430 memset(&p1, 0, sizeof(p1));
431 if (tnl_get_ioctl(name, &p1))
432 continue;
433 if ((p->link && p1.link != p->link) ||
434 (p->name[0] && strcmp(p1.name, p->name)) ||
435 (p->iph.daddr && p1.iph.daddr != p->iph.daddr) ||
436 (p->iph.saddr && p1.iph.saddr != p->iph.saddr) ||
437 (p->i_key && p1.i_key != p->i_key))
438 continue;
439 print_tunnel(&p1);
440 if (show_stats) {
441 printf("%s", _SL_);
442 printf("RX: Packets Bytes Errors CsumErrs OutOfSeq Mcasts%s", _SL_);
443 printf(" %-10ld %-12ld %-6ld %-8ld %-8ld %-8ld%s",
444 rx_packets, rx_bytes, rx_errs, rx_frame, rx_fifo, rx_multi, _SL_);
445 printf("TX: Packets Bytes Errors DeadLoop NoRoute NoBufs%s", _SL_);
446 printf(" %-10ld %-12ld %-6ld %-8ld %-8ld %-6ld",
447 tx_packets, tx_bytes, tx_errs, tx_colls, tx_carrier, tx_drops);
448 }
449 printf("\n");
450 }
451 err = 0;
452 end:
453 fclose(fp);
454 return err;
455 }
456
457 static int do_show(int argc, char **argv)
458 {
459 struct ip_tunnel_parm p;
460 const char *basedev;
461
462 ll_init_map(&rth);
463 if (parse_args(argc, argv, SIOCGETTUNNEL, &p) < 0)
464 return -1;
465
466 if (!(basedev = tnl_defname(&p)))
467 return do_tunnels_list(&p);
468
469 if (tnl_get_ioctl(p.name[0] ? p.name : basedev, &p))
470 return -1;
471
472 print_tunnel(&p);
473 printf("\n");
474 return 0;
475 }
476
477 static int do_prl(int argc, char **argv)
478 {
479 struct ip_tunnel_prl p;
480 int count = 0;
481 int devname = 0;
482 int cmd = 0;
483 char medium[IFNAMSIZ];
484
485 memset(&p, 0, sizeof(p));
486 memset(&medium, 0, sizeof(medium));
487
488 while (argc > 0) {
489 if (strcmp(*argv, "prl-default") == 0) {
490 NEXT_ARG();
491 cmd = SIOCADDPRL;
492 p.addr = get_addr32(*argv);
493 p.flags |= PRL_DEFAULT;
494 count++;
495 } else if (strcmp(*argv, "prl-nodefault") == 0) {
496 NEXT_ARG();
497 cmd = SIOCADDPRL;
498 p.addr = get_addr32(*argv);
499 count++;
500 } else if (strcmp(*argv, "prl-delete") == 0) {
501 NEXT_ARG();
502 cmd = SIOCDELPRL;
503 p.addr = get_addr32(*argv);
504 count++;
505 } else if (strcmp(*argv, "dev") == 0) {
506 NEXT_ARG();
507 strncpy(medium, *argv, IFNAMSIZ-1);
508 devname++;
509 } else {
510 fprintf(stderr,"Invalid PRL parameter \"%s\"\n", *argv);
511 exit(-1);
512 }
513 if (count > 1) {
514 fprintf(stderr,"One PRL entry at a time\n");
515 exit(-1);
516 }
517 argc--; argv++;
518 }
519 if (devname == 0) {
520 fprintf(stderr, "Must specify device\n");
521 exit(-1);
522 }
523
524 return tnl_prl_ioctl(cmd, medium, &p);
525 }
526
527 static int do_6rd(int argc, char **argv)
528 {
529 struct ip_tunnel_6rd ip6rd;
530 int devname = 0;
531 int cmd = 0;
532 char medium[IFNAMSIZ];
533 inet_prefix prefix;
534
535 memset(&ip6rd, 0, sizeof(ip6rd));
536 memset(&medium, 0, sizeof(medium));
537
538 while (argc > 0) {
539 if (strcmp(*argv, "6rd-prefix") == 0) {
540 NEXT_ARG();
541 if (get_prefix(&prefix, *argv, AF_INET6))
542 invarg("invalid 6rd_prefix\n", *argv);
543 cmd = SIOCADD6RD;
544 memcpy(&ip6rd.prefix, prefix.data, 16);
545 ip6rd.prefixlen = prefix.bitlen;
546 } else if (strcmp(*argv, "6rd-relay_prefix") == 0) {
547 NEXT_ARG();
548 if (get_prefix(&prefix, *argv, AF_INET))
549 invarg("invalid 6rd-relay_prefix\n", *argv);
550 cmd = SIOCADD6RD;
551 memcpy(&ip6rd.relay_prefix, prefix.data, 4);
552 ip6rd.relay_prefixlen = prefix.bitlen;
553 } else if (strcmp(*argv, "6rd-reset") == 0) {
554 cmd = SIOCDEL6RD;
555 } else if (strcmp(*argv, "dev") == 0) {
556 NEXT_ARG();
557 strncpy(medium, *argv, IFNAMSIZ-1);
558 devname++;
559 } else {
560 fprintf(stderr,"Invalid 6RD parameter \"%s\"\n", *argv);
561 exit(-1);
562 }
563 argc--; argv++;
564 }
565 if (devname == 0) {
566 fprintf(stderr, "Must specify device\n");
567 exit(-1);
568 }
569
570 return tnl_6rd_ioctl(cmd, medium, &ip6rd);
571 }
572
573 int do_iptunnel(int argc, char **argv)
574 {
575 switch (preferred_family) {
576 case AF_UNSPEC:
577 preferred_family = AF_INET;
578 break;
579 case AF_INET:
580 break;
581 /*
582 * This is silly enough but we have no easy way to make it
583 * protocol-independent because of unarranged structure between
584 * IPv4 and IPv6.
585 */
586 case AF_INET6:
587 return do_ip6tunnel(argc, argv);
588 default:
589 fprintf(stderr, "Unsupported protocol family: %d\n", preferred_family);
590 exit(-1);
591 }
592
593 if (argc > 0) {
594 if (matches(*argv, "add") == 0)
595 return do_add(SIOCADDTUNNEL, argc - 1, argv + 1);
596 if (matches(*argv, "change") == 0)
597 return do_add(SIOCCHGTUNNEL, argc - 1, argv + 1);
598 if (matches(*argv, "delete") == 0)
599 return do_del(argc - 1, argv + 1);
600 if (matches(*argv, "show") == 0 ||
601 matches(*argv, "lst") == 0 ||
602 matches(*argv, "list") == 0)
603 return do_show(argc - 1, argv + 1);
604 if (matches(*argv, "prl") == 0)
605 return do_prl(argc - 1, argv + 1);
606 if (matches(*argv, "6rd") == 0)
607 return do_6rd(argc - 1, argv + 1);
608 if (matches(*argv, "help") == 0)
609 usage();
610 } else
611 return do_show(0, NULL);
612
613 fprintf(stderr, "Command \"%s\" is unknown, try \"ip tunnel help\"\n", *argv);
614 exit(-1);
615 }