Skip to content

Commit

Permalink
flow_dissector: Don't use bit fields.
Browse files Browse the repository at this point in the history
Just have a flags member instead.

   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from net/core/flow_dissector.c:1:
   In function 'flow_keys_hash_start',
       inlined from 'flow_hash_from_keys' at net/core/flow_dissector.c:553:34:
>> include/linux/compiler.h:447:38: error: call to '__compiletime_assert_459' declared with attribute error: BUILD_BUG_ON failed: FLOW_KEYS_HASH_OFFSET % sizeof(u32)

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
davem330 committed Sep 1, 2015
1 parent 41ecc3d commit 4b36993
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
8 changes: 5 additions & 3 deletions include/net/flow_dissector.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
struct flow_dissector_key_control {
u16 thoff;
u16 addr_type;
u32 is_fragment:1;
u32 first_frag:1;
u32 encapsulation:1;
u32 flags;
};

#define FLOW_DIS_IS_FRAGMENT BIT(0)
#define FLOW_DIS_FIRST_FRAG BIT(1)
#define FLOW_DIS_ENCAPSULATION BIT(2)

/**
* struct flow_dissector_key_basic:
* @thoff: Transport header offset
Expand Down
14 changes: 7 additions & 7 deletions net/core/flow_dissector.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
key_control->addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS;

if (ip_is_fragment(iph)) {
key_control->is_fragment = 1;
key_control->flags |= FLOW_DIS_IS_FRAGMENT;

if (iph->frag_off & htons(IP_OFFSET)) {
goto out_good;
} else {
key_control->first_frag = 1;
key_control->flags |= FLOW_DIS_FIRST_FRAG;
if (!(flags & FLOW_DISSECTOR_F_PARSE_1ST_FRAG))
goto out_good;
}
Expand Down Expand Up @@ -398,7 +398,7 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
nhoff += sizeof(*eth);
}

key_control->encapsulation = 1;
key_control->flags |= FLOW_DIS_ENCAPSULATION;
if (flags & FLOW_DISSECTOR_F_STOP_AT_ENCAP)
goto out_good;

Expand Down Expand Up @@ -434,12 +434,12 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
if (!fh)
goto out_bad;

key_control->is_fragment = 1;
key_control->flags |= FLOW_DIS_IS_FRAGMENT;

nhoff += sizeof(_fh);

if (!(fh->frag_off & htons(IP6_OFFSET))) {
key_control->first_frag = 1;
key_control->flags |= FLOW_DIS_FIRST_FRAG;
if (flags & FLOW_DISSECTOR_F_PARSE_1ST_FRAG) {
ip_proto = fh->nexthdr;
goto ip_proto_again;
Expand All @@ -450,15 +450,15 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
case IPPROTO_IPIP:
proto = htons(ETH_P_IP);

key_control->encapsulation = 1;
key_control->flags |= FLOW_DIS_ENCAPSULATION;
if (flags & FLOW_DISSECTOR_F_STOP_AT_ENCAP)
goto out_good;

goto ip;
case IPPROTO_IPV6:
proto = htons(ETH_P_IPV6);

key_control->encapsulation = 1;
key_control->flags |= FLOW_DIS_ENCAPSULATION;
if (flags & FLOW_DISSECTOR_F_STOP_AT_ENCAP)
goto out_good;

Expand Down

0 comments on commit 4b36993

Please sign in to comment.