netfilter: flowtable: move FLOW_OFFLOAD_DIR_MAX away from enumeration
This allows to remove the default case which should not ever happen and that was added to avoid gcc warnings on unhandled FLOW_OFFLOAD_DIR_MAX enumeration case. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
2babb46c8c
commit
4f08f173d0
@ -86,8 +86,8 @@ static inline bool nf_flowtable_hw_offload(struct nf_flowtable *flowtable)
|
|||||||
enum flow_offload_tuple_dir {
|
enum flow_offload_tuple_dir {
|
||||||
FLOW_OFFLOAD_DIR_ORIGINAL = IP_CT_DIR_ORIGINAL,
|
FLOW_OFFLOAD_DIR_ORIGINAL = IP_CT_DIR_ORIGINAL,
|
||||||
FLOW_OFFLOAD_DIR_REPLY = IP_CT_DIR_REPLY,
|
FLOW_OFFLOAD_DIR_REPLY = IP_CT_DIR_REPLY,
|
||||||
FLOW_OFFLOAD_DIR_MAX = IP_CT_DIR_MAX
|
|
||||||
};
|
};
|
||||||
|
#define FLOW_OFFLOAD_DIR_MAX IP_CT_DIR_MAX
|
||||||
|
|
||||||
struct flow_offload_tuple {
|
struct flow_offload_tuple {
|
||||||
union {
|
union {
|
||||||
|
@ -454,8 +454,6 @@ int nf_flow_snat_port(const struct flow_offload *flow,
|
|||||||
new_port = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_port;
|
new_port = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_port;
|
||||||
hdr->dest = new_port;
|
hdr->dest = new_port;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf_flow_nat_port(skb, thoff, protocol, port, new_port);
|
return nf_flow_nat_port(skb, thoff, protocol, port, new_port);
|
||||||
@ -482,8 +480,6 @@ int nf_flow_dnat_port(const struct flow_offload *flow,
|
|||||||
new_port = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_port;
|
new_port = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_port;
|
||||||
hdr->source = new_port;
|
hdr->source = new_port;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf_flow_nat_port(skb, thoff, protocol, port, new_port);
|
return nf_flow_nat_port(skb, thoff, protocol, port, new_port);
|
||||||
|
@ -96,8 +96,6 @@ static int nf_flow_snat_ip(const struct flow_offload *flow, struct sk_buff *skb,
|
|||||||
new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_v4.s_addr;
|
new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_v4.s_addr;
|
||||||
iph->daddr = new_addr;
|
iph->daddr = new_addr;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
csum_replace4(&iph->check, addr, new_addr);
|
csum_replace4(&iph->check, addr, new_addr);
|
||||||
|
|
||||||
@ -121,8 +119,6 @@ static int nf_flow_dnat_ip(const struct flow_offload *flow, struct sk_buff *skb,
|
|||||||
new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_v4.s_addr;
|
new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_v4.s_addr;
|
||||||
iph->saddr = new_addr;
|
iph->saddr = new_addr;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
csum_replace4(&iph->check, addr, new_addr);
|
csum_replace4(&iph->check, addr, new_addr);
|
||||||
|
|
||||||
@ -371,8 +367,6 @@ static int nf_flow_snat_ipv6(const struct flow_offload *flow,
|
|||||||
new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_v6;
|
new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_v6;
|
||||||
ip6h->daddr = new_addr;
|
ip6h->daddr = new_addr;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf_flow_nat_ipv6_l4proto(skb, ip6h, thoff, &addr, &new_addr);
|
return nf_flow_nat_ipv6_l4proto(skb, ip6h, thoff, &addr, &new_addr);
|
||||||
@ -396,8 +390,6 @@ static int nf_flow_dnat_ipv6(const struct flow_offload *flow,
|
|||||||
new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_v6;
|
new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_v6;
|
||||||
ip6h->saddr = new_addr;
|
ip6h->saddr = new_addr;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf_flow_nat_ipv6_l4proto(skb, ip6h, thoff, &addr, &new_addr);
|
return nf_flow_nat_ipv6_l4proto(skb, ip6h, thoff, &addr, &new_addr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user