[ovs-dev] xlate: use const struct in6_addr in linklocal check
diff mbox series

Message ID 20180710133438.24880-1-aconole@redhat.com
State Accepted
Headers show
Series
  • [ovs-dev] xlate: use const struct in6_addr in linklocal check
Related show

Commit Message

Aaron Conole July 10, 2018, 1:34 p.m. UTC
Commit 83c2757bd16e ("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: 83c2757bd16e ("xlate: Move tnl_neigh_snoop() to terminate_native_tunnel()")
Cc: Zoltan Balogh <zoltan.balogh.eth@gmail.com>
Cc: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
---
 ofproto/ofproto-dpif-xlate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Pfaff July 10, 2018, 4:19 p.m. UTC | #1
On Tue, Jul 10, 2018 at 09:34:38AM -0400, Aaron Conole wrote:
> Commit 83c2757bd16e ("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: 83c2757bd16e ("xlate: Move tnl_neigh_snoop() to terminate_native_tunnel()")
> Cc: Zoltan Balogh <zoltan.balogh.eth@gmail.com>
> Cc: Jan Scheurich <jan.scheurich@ericsson.com>
> Signed-off-by: Aaron Conole <aconole@redhat.com>

Thanks, applied to master.

Patch
diff mbox series

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index c02a0327a..8c95935fa 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -3832,7 +3832,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] &&