mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
[NETFILTER]: nf_conntrack: endian annotations
Resync with Al Viro's ip_conntrack annotations and fix a missed spot in ip_nat_proto_icmp.c. Signed-off-by: Patrick McHardy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
f9aae95828
commit
bff9a89bca
11 changed files with 58 additions and 65 deletions
|
|
@ -24,8 +24,8 @@ icmp_in_range(const struct ip_conntrack_tuple *tuple,
|
|||
const union ip_conntrack_manip_proto *min,
|
||||
const union ip_conntrack_manip_proto *max)
|
||||
{
|
||||
return (tuple->src.u.icmp.id >= min->icmp.id
|
||||
&& tuple->src.u.icmp.id <= max->icmp.id);
|
||||
return ntohs(tuple->src.u.icmp.id) >= ntohs(min->icmp.id) &&
|
||||
ntohs(tuple->src.u.icmp.id) <= ntohs(max->icmp.id);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
static int ipv4_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff,
|
||||
struct nf_conntrack_tuple *tuple)
|
||||
{
|
||||
u_int32_t _addrs[2], *ap;
|
||||
__be32 _addrs[2], *ap;
|
||||
ap = skb_header_pointer(skb, nhoff + offsetof(struct iphdr, saddr),
|
||||
sizeof(u_int32_t) * 2, _addrs);
|
||||
if (ap == NULL)
|
||||
|
|
@ -410,10 +410,8 @@ static int ipv4_nfattr_to_tuple(struct nfattr *tb[],
|
|||
if (nfattr_bad_size(tb, CTA_IP_MAX, cta_min_ip))
|
||||
return -EINVAL;
|
||||
|
||||
t->src.u3.ip =
|
||||
*(u_int32_t *)NFA_DATA(tb[CTA_IP_V4_SRC-1]);
|
||||
t->dst.u3.ip =
|
||||
*(u_int32_t *)NFA_DATA(tb[CTA_IP_V4_DST-1]);
|
||||
t->src.u3.ip = *(__be32 *)NFA_DATA(tb[CTA_IP_V4_SRC-1]);
|
||||
t->dst.u3.ip = *(__be32 *)NFA_DATA(tb[CTA_IP_V4_DST-1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ static int icmp_nfattr_to_tuple(struct nfattr *tb[],
|
|||
tuple->dst.u.icmp.code =
|
||||
*(u_int8_t *)NFA_DATA(tb[CTA_PROTO_ICMP_CODE-1]);
|
||||
tuple->src.u.icmp.id =
|
||||
*(u_int16_t *)NFA_DATA(tb[CTA_PROTO_ICMP_ID-1]);
|
||||
*(__be16 *)NFA_DATA(tb[CTA_PROTO_ICMP_ID-1]);
|
||||
|
||||
if (tuple->dst.u.icmp.type >= sizeof(invmap)
|
||||
|| !invmap[tuple->dst.u.icmp.type])
|
||||
|
|
|
|||
Loading…
Reference in a new issue