mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 14:41:27 +00:00
ip_tunnels: add IPv6 addresses to ip_tunnel_key
Add the IPv6 addresses as an union with IPv4 ones. When using IPv4, the newly introduced padding after the IPv4 addresses needs to be zeroed out. Signed-off-by: Jiri Benc <jbenc@redhat.com> Acked-by: Thomas Graf <tgraf@suug.ch> Acked-by: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
376534a3d1
commit
c1ea5d672a
10 changed files with 48 additions and 32 deletions
|
@ -534,11 +534,11 @@ static int ipv4_tun_from_nlattr(const struct nlattr *attr,
|
|||
tun_flags |= TUNNEL_KEY;
|
||||
break;
|
||||
case OVS_TUNNEL_KEY_ATTR_IPV4_SRC:
|
||||
SW_FLOW_KEY_PUT(match, tun_key.ipv4_src,
|
||||
SW_FLOW_KEY_PUT(match, tun_key.u.ipv4.src,
|
||||
nla_get_in_addr(a), is_mask);
|
||||
break;
|
||||
case OVS_TUNNEL_KEY_ATTR_IPV4_DST:
|
||||
SW_FLOW_KEY_PUT(match, tun_key.ipv4_dst,
|
||||
SW_FLOW_KEY_PUT(match, tun_key.u.ipv4.dst,
|
||||
nla_get_in_addr(a), is_mask);
|
||||
break;
|
||||
case OVS_TUNNEL_KEY_ATTR_TOS:
|
||||
|
@ -609,7 +609,7 @@ static int ipv4_tun_from_nlattr(const struct nlattr *attr,
|
|||
}
|
||||
|
||||
if (!is_mask) {
|
||||
if (!match->key->tun_key.ipv4_dst) {
|
||||
if (!match->key->tun_key.u.ipv4.dst) {
|
||||
OVS_NLERR(log, "IPv4 tunnel dst address is zero");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -647,13 +647,13 @@ static int __ipv4_tun_to_nlattr(struct sk_buff *skb,
|
|||
if (output->tun_flags & TUNNEL_KEY &&
|
||||
nla_put_be64(skb, OVS_TUNNEL_KEY_ATTR_ID, output->tun_id))
|
||||
return -EMSGSIZE;
|
||||
if (output->ipv4_src &&
|
||||
if (output->u.ipv4.src &&
|
||||
nla_put_in_addr(skb, OVS_TUNNEL_KEY_ATTR_IPV4_SRC,
|
||||
output->ipv4_src))
|
||||
output->u.ipv4.src))
|
||||
return -EMSGSIZE;
|
||||
if (output->ipv4_dst &&
|
||||
if (output->u.ipv4.dst &&
|
||||
nla_put_in_addr(skb, OVS_TUNNEL_KEY_ATTR_IPV4_DST,
|
||||
output->ipv4_dst))
|
||||
output->u.ipv4.dst))
|
||||
return -EMSGSIZE;
|
||||
if (output->ipv4_tos &&
|
||||
nla_put_u8(skb, OVS_TUNNEL_KEY_ATTR_TOS, output->ipv4_tos))
|
||||
|
@ -1116,7 +1116,7 @@ int ovs_nla_get_match(struct sw_flow_match *match,
|
|||
/* The userspace does not send tunnel attributes that
|
||||
* are 0, but we should not wildcard them nonetheless.
|
||||
*/
|
||||
if (match->key->tun_key.ipv4_dst)
|
||||
if (match->key->tun_key.u.ipv4.dst)
|
||||
SW_FLOW_KEY_MEMSET_FIELD(match, tun_key,
|
||||
0xff, true);
|
||||
|
||||
|
@ -1287,7 +1287,7 @@ static int __ovs_nla_put_key(const struct sw_flow_key *swkey,
|
|||
if (nla_put_u32(skb, OVS_KEY_ATTR_PRIORITY, output->phy.priority))
|
||||
goto nla_put_failure;
|
||||
|
||||
if ((swkey->tun_key.ipv4_dst || is_mask)) {
|
||||
if ((swkey->tun_key.u.ipv4.dst || is_mask)) {
|
||||
const void *opts = NULL;
|
||||
|
||||
if (output->tun_key.tun_flags & TUNNEL_OPTIONS_PRESENT)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue