Fix warnings found by Clang 5.0 (-Wself-assign and -Wparentheses-equality).

Move code from ipv6-utils.h to packet-ipv6.c since that was the only
place it was used. Comment out unused code.

svn path=/trunk/; revision=52645
This commit is contained in:
Gerald Combs 2013-10-16 17:19:59 +00:00
parent 4515b2b3aa
commit 1701f42969
3 changed files with 35 additions and 19 deletions

View File

@ -486,6 +486,36 @@ again:
}
}
/**
* Unicast Scope
* Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
*/
/* XXX Currently unused
static inline gboolean in6_is_addr_link_local(struct e_in6_addr *a) {
if ((a->bytes[0] == 0xfe) && ((a->bytes[1] & 0xc0) == 0x80)) {
return TRUE;
}
return FALSE;
}
static inline gboolean in6_is_addr_sitelocal(struct e_in6_addr *a) {
if ((a->bytes[0] == 0xfe) && ((a->bytes[1] & 0xc0) == 0xc0)) {
return TRUE;
}
return FALSE;
}
*/
/**
* Multicast
*/
static inline gboolean in6_is_addr_multicast(struct e_in6_addr *a) {
if (a->bytes[0] == 0xff) {
return TRUE;
}
return FALSE;
}
#ifdef HAVE_GEOIP_V6
static void
add_geoip_info_entry(proto_tree *geoip_info_item, tvbuff_t *tvb, gint offset, const struct e_in6_addr *ip, int isdst)
@ -695,7 +725,7 @@ dissect_routing6(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo
memcpy((guint8 *)&srcAddr, (guint8 *)pinfo->src.data, pinfo->src.len);
/* from RFC6554: Multicast addresses MUST NOT appear in the IPv6 Destination Address field */
if(g_ipv6_rpl_srh_strict_rfc_checking && E_IN6_IS_ADDR_MULTICAST(&dstAddr)){
if(g_ipv6_rpl_srh_strict_rfc_checking && in6_is_addr_multicast(&dstAddr)){
expert_add_info(pinfo, ti, &ei_ipv6_dst_addr_not_multicast);
}
@ -791,7 +821,7 @@ dissect_routing6(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo
}
/* Multicast addresses MUST NOT appear in the in SRH */
if(E_IN6_IS_ADDR_MULTICAST(&addr)){
if(in6_is_addr_multicast(&addr)){
expert_add_info(pinfo, ti, &ei_ipv6_src_route_list_multicast_addr);
}
}
@ -820,7 +850,7 @@ dissect_routing6(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo
}
/* Multicast addresses MUST NOT appear in the in SRH */
if(E_IN6_IS_ADDR_MULTICAST(&addr)){
if(in6_is_addr_multicast(&addr)){
expert_add_info(pinfo, ti, &ei_ipv6_src_route_list_multicast_addr);
}
}

View File

@ -3008,7 +3008,7 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i
if (val_id <= 4) { /* Length field already parsed by macro! */ \
get_long_integer(val, tvb, off, len, ok); \
if (ok) { \
val = val; /* hack to prevent 'set but not used' gcc warning */ \
val = 0; /* hack to prevent 'set but not used' gcc warning */ \
tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
tvb, hdr_start, offset - hdr_start, \
@ -3330,7 +3330,7 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i
if (val_id <= 4) { /* Length field already parsed by macro! */ \
get_long_integer(val, tvb, off, len, ok); \
if (ok) { \
val = val; /* hack to prevent 'set but not used' gcc warning */ \
val = 0; /* hack to prevent 'set but not used' gcc warning */ \
val_str = try_val_to_str_ext(val_id & 0x7F, valueStringExtAddr); \
if (val_str) { \
tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \

View File

@ -37,18 +37,4 @@ typedef struct {
guint32 prefix;
} ipv6_addr;
/**
* Unicast Scope
* Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
*/
#define E_IN6_IS_ADDR_LINKLOCAL(a) \
(((a)->bytes[0] == 0xfe) && (((a)->bytes[1] & 0xc0) == 0x80))
#define E_IN6_IS_ADDR_SITELOCAL(a) \
(((a)->bytes[0] == 0xfe) && (((a)->bytes[1] & 0xc0) == 0xc0))
/**
* Multicast
*/
#define E_IN6_IS_ADDR_MULTICAST(a) ((a)->bytes[0] == 0xff)
#endif /* __IPV6_UTILS_H__ */