diff options
| author | Michal Kubeček <mkubecek@suse.cz> | 2015-11-03 02:51:07 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-11-03 10:52:13 -0500 |
| commit | ebac62fe3d24c0ce22dd83afa7b07d1a2aaef44d (patch) | |
| tree | 5b5735d3f8be792cda24ce569e0ebcdddae989b0 | |
| parent | 5f6c99e0ab805d8ec9eda105822912d49aa1d409 (diff) | |
ipv6: fix tunnel error handling
Both tunnel6_protocol and tunnel46_protocol share the same error
handler, tunnel6_err(), which traverses through tunnel6_handlers list.
For ipip6 tunnels, we need to traverse tunnel46_handlers as we do e.g.
in tunnel46_rcv(). Current code can generate an ICMPv6 error message
with an IPv4 packet embedded in it.
Fixes: 73d605d1abbd ("[IPSEC]: changing API of xfrm6_tunnel_register")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | net/ipv6/tunnel6.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/net/ipv6/tunnel6.c b/net/ipv6/tunnel6.c index 3c758007b327..dae25cad05cd 100644 --- a/net/ipv6/tunnel6.c +++ b/net/ipv6/tunnel6.c | |||
| @@ -144,6 +144,16 @@ static void tunnel6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
| 144 | break; | 144 | break; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | static void tunnel46_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | ||
| 148 | u8 type, u8 code, int offset, __be32 info) | ||
| 149 | { | ||
| 150 | struct xfrm6_tunnel *handler; | ||
| 151 | |||
| 152 | for_each_tunnel_rcu(tunnel46_handlers, handler) | ||
| 153 | if (!handler->err_handler(skb, opt, type, code, offset, info)) | ||
| 154 | break; | ||
| 155 | } | ||
| 156 | |||
| 147 | static const struct inet6_protocol tunnel6_protocol = { | 157 | static const struct inet6_protocol tunnel6_protocol = { |
| 148 | .handler = tunnel6_rcv, | 158 | .handler = tunnel6_rcv, |
| 149 | .err_handler = tunnel6_err, | 159 | .err_handler = tunnel6_err, |
| @@ -152,7 +162,7 @@ static const struct inet6_protocol tunnel6_protocol = { | |||
| 152 | 162 | ||
| 153 | static const struct inet6_protocol tunnel46_protocol = { | 163 | static const struct inet6_protocol tunnel46_protocol = { |
| 154 | .handler = tunnel46_rcv, | 164 | .handler = tunnel46_rcv, |
| 155 | .err_handler = tunnel6_err, | 165 | .err_handler = tunnel46_err, |
| 156 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, | 166 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, |
| 157 | }; | 167 | }; |
| 158 | 168 | ||
