Setting tag iproute2-2.6.38-1
[iproute2.git] / gre.patch
1 diff -ur iproute2-2.6.33.orig/include/linux/if_tunnel.h iproute2-2.6.33/include/linux/if_tunnel.h
2 --- iproute2-2.6.33.orig/include/linux/if_tunnel.h      2010-02-24 22:56:50.000000000 -0500
3 +++ iproute2-2.6.33/include/linux/if_tunnel.h   2010-04-16 11:18:49.412491322 -0400
4 @@ -33,6 +33,7 @@
5         __be16                  o_flags;
6         __be32                  i_key;
7         __be32                  o_key;
8 +       __be16                  proto_type;    /* Added for EGRE */
9         struct iphdr            iph;
10  };
11  
12 diff -ur iproute2-2.6.33.orig/ip/iptunnel.c iproute2-2.6.33/ip/iptunnel.c
13 --- iproute2-2.6.33.orig/ip/iptunnel.c  2010-02-24 22:56:50.000000000 -0500
14 +++ iproute2-2.6.33/ip/iptunnel.c       2010-04-16 11:20:58.152357650 -0400
15 @@ -28,12 +28,15 @@
16  #include "ip_common.h"
17  #include "tunnel.h"
18  
19 +#define ETH_P_ETH      0x6558  /* Ethernet in Ethernet */
20 +
21 +
22  static void usage(void) __attribute__((noreturn));
23  
24  static void usage(void)
25  {
26         fprintf(stderr, "Usage: ip tunnel { add | change | del | show | prl | 6rd } [ NAME ]\n");
27 -       fprintf(stderr, "          [ mode { ipip | gre | sit | isatap } ] [ remote ADDR ] [ local ADDR ]\n");
28 +       fprintf(stderr, "          [ mode { ipip | gre [ type { ip | eth } ] | sit | isatap } ] [ remote ADDR ] [ local ADDR ]\n");
29         fprintf(stderr, "          [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum ]\n");
30         fprintf(stderr, "          [ prl-default ADDR ] [ prl-nodefault ADDR ] [ prl-delete ADDR ]\n");
31         fprintf(stderr, "          [ 6rd-prefix ADDR ] [ 6rd-relay_prefix ADDR ] [ 6rd-reset ]\n");
32 @@ -80,6 +83,20 @@
33                                         exit(-1);
34                                 }
35                                 p->iph.protocol = IPPROTO_GRE;
36 +                NEXT_ARG();
37 +                if (strcmp(*argv,"type") == 0)
38 +                {
39 +                    NEXT_ARG();
40 +                    printf("90 route %s\n", *argv);
41 +                    if (strcmp(*argv,"eth") == 0)
42 +                    {
43 +                    p->proto_type = ETH_P_ETH;
44 +                    }
45 +                    else
46 +                    {
47 +                    p->proto_type = ETH_P_IP;
48 +                    }
49 +                }
50                         } else if (strcmp(*argv, "sit") == 0 ||
51                                    strcmp(*argv, "ipv6/ip") == 0) {
52                                 if (p->iph.protocol && p->iph.protocol != IPPROTO_IPV6) {
53 @@ -316,6 +333,13 @@
54         /* Do not use format_host() for local addr,
55          * symbolic name will not be useful.
56          */
57 +     if(p->proto_type == ETH_P_ETH)
58 +                  printf("%s: %s/eth  remote %s  local %s ",
59 +                          p->name,
60 +                          tnl_strproto(p->iph.protocol),
61 +                          p->iph.daddr ? format_host(AF_INET, 4, &p->iph.daddr, s1, sizeof(s1))  : "any",
62 +                          p->iph.saddr ? rt_addr_n2a(AF_INET, 4, &p->iph.saddr, s2, sizeof(s2)) : "any");
63 +     else
64         printf("%s: %s/ip  remote %s  local %s ",
65                p->name,
66                tnl_strproto(p->iph.protocol),