Skip to content

Commit

Permalink
xlate: use const struct in6_addr in linklocal check
Browse files Browse the repository at this point in the history
Commit 83c2757 ("xlate: Move tnl_neigh_snoop() to
terminate_native_tunnel()") introduced a call to
IN6_IS_ADDR_MC_LINKLOCAL() when checking neighbor discovery.

The call to this assumes that the argument may be a const uint8_t *.
According to The Open Group Base Specifications Issue 7, 2018:

    macro is of type int and takes a single argument of
    type const struct in6_addr *

The GNU implementation allows a bit of flexibility, by internally
casting the argument.  However, other implementations (such as OS X)
more rigidly implement the standard and fail with errors like:

    error: member reference base type 'const uint8_t'
           (aka 'const unsigned char') is not a structure or union

Fixes: 83c2757 ("xlate: Move tnl_neigh_snoop() to terminate_native_tunnel()")
Cc: Zoltan Balogh <[email protected]>
Cc: Jan Scheurich <[email protected]>
Signed-off-by: Aaron Conole <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
apconole authored and blp committed Jul 10, 2018
1 parent b22fb00 commit 6f231f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ofproto/ofproto-dpif-xlate.c
Original file line number Diff line number Diff line change
Expand Up @@ -3831,7 +3831,7 @@ is_nd_dst_correct(const struct flow *flow, const struct in6_addr *ipv6_addr)
const uint8_t *flow_ipv6_addr = (uint8_t *) &flow->ipv6_dst;
const uint8_t *addr = (uint8_t *) ipv6_addr;

return (IN6_IS_ADDR_MC_LINKLOCAL(flow_ipv6_addr) &&
return (IN6_IS_ADDR_MC_LINKLOCAL(ipv6_addr) &&
flow_ipv6_addr[11] == 0x01 &&
flow_ipv6_addr[12] == 0xff &&
flow_ipv6_addr[13] == addr[13] &&
Expand Down

0 comments on commit 6f231f7

Please sign in to comment.