diff options
-rw-r--r-- | net/ipv6/sit.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 27fe10ffacb0..1efa95a99f45 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -99,10 +99,10 @@ static struct ip_tunnel * ipip6_tunnel_lookup(__be32 remote, __be32 local) | |||
99 | return NULL; | 99 | return NULL; |
100 | } | 100 | } |
101 | 101 | ||
102 | static struct ip_tunnel ** ipip6_bucket(struct ip_tunnel *t) | 102 | static struct ip_tunnel **__ipip6_bucket(struct ip_tunnel_parm *parms) |
103 | { | 103 | { |
104 | __be32 remote = t->parms.iph.daddr; | 104 | __be32 remote = parms->iph.daddr; |
105 | __be32 local = t->parms.iph.saddr; | 105 | __be32 local = parms->iph.saddr; |
106 | unsigned h = 0; | 106 | unsigned h = 0; |
107 | int prio = 0; | 107 | int prio = 0; |
108 | 108 | ||
@@ -117,6 +117,11 @@ static struct ip_tunnel ** ipip6_bucket(struct ip_tunnel *t) | |||
117 | return &tunnels[prio][h]; | 117 | return &tunnels[prio][h]; |
118 | } | 118 | } |
119 | 119 | ||
120 | static inline struct ip_tunnel **ipip6_bucket(struct ip_tunnel *t) | ||
121 | { | ||
122 | return __ipip6_bucket(&t->parms); | ||
123 | } | ||
124 | |||
120 | static void ipip6_tunnel_unlink(struct ip_tunnel *t) | 125 | static void ipip6_tunnel_unlink(struct ip_tunnel *t) |
121 | { | 126 | { |
122 | struct ip_tunnel **tp; | 127 | struct ip_tunnel **tp; |
@@ -147,19 +152,9 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int | |||
147 | __be32 local = parms->iph.saddr; | 152 | __be32 local = parms->iph.saddr; |
148 | struct ip_tunnel *t, **tp, *nt; | 153 | struct ip_tunnel *t, **tp, *nt; |
149 | struct net_device *dev; | 154 | struct net_device *dev; |
150 | unsigned h = 0; | ||
151 | int prio = 0; | ||
152 | char name[IFNAMSIZ]; | 155 | char name[IFNAMSIZ]; |
153 | 156 | ||
154 | if (remote) { | 157 | for (tp = __ipip6_bucket(parms); (t = *tp) != NULL; tp = &t->next) { |
155 | prio |= 2; | ||
156 | h ^= HASH(remote); | ||
157 | } | ||
158 | if (local) { | ||
159 | prio |= 1; | ||
160 | h ^= HASH(local); | ||
161 | } | ||
162 | for (tp = &tunnels[prio][h]; (t = *tp) != NULL; tp = &t->next) { | ||
163 | if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr) | 158 | if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr) |
164 | return t; | 159 | return t; |
165 | } | 160 | } |