On Tue, Jun 23, 2015 at 05:03:15PM -0300, Thadeu Lima de Souza Cascardo wrote: > Use IPv6 internally for storing multicast addresses. IPv4 addresses are > translated to their IPv4-mapped equivalent. > > Signed-off-by: Thadeu Lima de Souza Cascardo <casca...@redhat.com>
From Clang: ../lib/mcast-snooping.c:93:23: error: cast from 'const uint8_t *' (aka 'const unsigned char *') to 'const uint32_t *' (aka 'const unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align] return hash_words((const uint32_t *) grp_addr->s6_addr, 4, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From "sparse": ../lib/mcast-snooping.c:133:20: warning: incorrect type in assignment (different base types) ../lib/mcast-snooping.c:133:20: expected restricted ovs_be16 <noident> ../lib/mcast-snooping.c:133:20: got int ../lib/mcast-snooping.c:133:20: warning: incorrect type in assignment (different base types) ../lib/mcast-snooping.c:133:20: expected restricted ovs_be16 <noident> ../lib/mcast-snooping.c:133:20: got int ../lib/mcast-snooping.c:133:20: warning: incorrect type in assignment (different base types) ../lib/mcast-snooping.c:133:20: expected restricted ovs_be16 <noident> ../lib/mcast-snooping.c:133:20: got int Probably the appropriate fixes for the above (also, use struct assignment): diff --git a/lib/mcast-snooping.c b/lib/mcast-snooping.c index f2684f3..294534e 100644 --- a/lib/mcast-snooping.c +++ b/lib/mcast-snooping.c @@ -90,7 +90,7 @@ static uint32_t mcast_table_hash(const struct mcast_snooping *ms, const struct in6_addr *grp_addr, uint16_t vlan) { - return hash_words((const uint32_t *) grp_addr->s6_addr, 4, + return hash_bytes(grp_addr->s6_addr, 16, hash_2words(ms->secret, vlan)); } @@ -130,7 +130,7 @@ in6_addr_set_mapped_ipv4(struct in6_addr *addr, ovs_be32 ip4) { union ovs_16aligned_in6_addr *taddr = (void *) addr; memset(taddr->be16, 0, sizeof(taddr->be16)); - taddr->be16[5] = 0xffff; + taddr->be16[5] = OVS_BE16_MAX; put_16aligned_be32(&taddr->be32[3], ip4); } @@ -422,7 +422,7 @@ mcast_snooping_add_group(struct mcast_snooping *ms, grp = xmalloc(sizeof *grp); hmap_insert(&ms->table, &grp->hmap_node, hash); - memcpy(grp->addr.s6_addr, addr->s6_addr, sizeof(addr->s6_addr)); + grp->addr = *addr; grp->vlan = vlan; list_init(&grp->bundle_lru); learned = true; Will you roll a v2? _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev