vti: Use the tunnel mark for lookup in the error handlers.
We need to use the mark we get from the tunnels o_key to lookup the right vti state in the error handlers. This patch ensures that. Fixes:df3893c1
("vti: Update the ipv4 side to use it's own receive hook.") Fixes:fa9ad96d
("vti6: Update the ipv6 side to use its own receive hook.") Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
parent
fd71143645
commit
6d004d6cc7
2 changed files with 8 additions and 2 deletions
|
@ -239,6 +239,7 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
static int vti4_err(struct sk_buff *skb, u32 info)
|
static int vti4_err(struct sk_buff *skb, u32 info)
|
||||||
{
|
{
|
||||||
__be32 spi;
|
__be32 spi;
|
||||||
|
__u32 mark;
|
||||||
struct xfrm_state *x;
|
struct xfrm_state *x;
|
||||||
struct ip_tunnel *tunnel;
|
struct ip_tunnel *tunnel;
|
||||||
struct ip_esp_hdr *esph;
|
struct ip_esp_hdr *esph;
|
||||||
|
@ -254,6 +255,8 @@ static int vti4_err(struct sk_buff *skb, u32 info)
|
||||||
if (!tunnel)
|
if (!tunnel)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
mark = be32_to_cpu(tunnel->parms.o_key);
|
||||||
|
|
||||||
switch (protocol) {
|
switch (protocol) {
|
||||||
case IPPROTO_ESP:
|
case IPPROTO_ESP:
|
||||||
esph = (struct ip_esp_hdr *)(skb->data+(iph->ihl<<2));
|
esph = (struct ip_esp_hdr *)(skb->data+(iph->ihl<<2));
|
||||||
|
@ -281,7 +284,7 @@ static int vti4_err(struct sk_buff *skb, u32 info)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
x = xfrm_state_lookup(net, skb->mark, (const xfrm_address_t *)&iph->daddr,
|
x = xfrm_state_lookup(net, mark, (const xfrm_address_t *)&iph->daddr,
|
||||||
spi, protocol, AF_INET);
|
spi, protocol, AF_INET);
|
||||||
if (!x)
|
if (!x)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -511,6 +511,7 @@ static int vti6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
|
||||||
u8 type, u8 code, int offset, __be32 info)
|
u8 type, u8 code, int offset, __be32 info)
|
||||||
{
|
{
|
||||||
__be32 spi;
|
__be32 spi;
|
||||||
|
__u32 mark;
|
||||||
struct xfrm_state *x;
|
struct xfrm_state *x;
|
||||||
struct ip6_tnl *t;
|
struct ip6_tnl *t;
|
||||||
struct ip_esp_hdr *esph;
|
struct ip_esp_hdr *esph;
|
||||||
|
@ -524,6 +525,8 @@ static int vti6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
|
||||||
if (!t)
|
if (!t)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
mark = be32_to_cpu(t->parms.o_key);
|
||||||
|
|
||||||
switch (protocol) {
|
switch (protocol) {
|
||||||
case IPPROTO_ESP:
|
case IPPROTO_ESP:
|
||||||
esph = (struct ip_esp_hdr *)(skb->data + offset);
|
esph = (struct ip_esp_hdr *)(skb->data + offset);
|
||||||
|
@ -545,7 +548,7 @@ static int vti6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
|
||||||
type != NDISC_REDIRECT)
|
type != NDISC_REDIRECT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
x = xfrm_state_lookup(net, skb->mark, (const xfrm_address_t *)&iph->daddr,
|
x = xfrm_state_lookup(net, mark, (const xfrm_address_t *)&iph->daddr,
|
||||||
spi, protocol, AF_INET6);
|
spi, protocol, AF_INET6);
|
||||||
if (!x)
|
if (!x)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue