Merge "Fix IPv6 filtering definitions in netinet/icmp6.h."

This commit is contained in:
Elliott Hughes 2013-07-08 17:32:17 +00:00 committed by Gerrit Code Review
commit 6b33f31b09

View file

@ -533,18 +533,28 @@ struct icmp6_filter {
u_int32_t icmp6_filt[8];
};
/*
* BEGIN android-changed
* Linux and *BSD kernels use opposite values to indicate pass/block in ICMPv6
* filters, and assign a different value to the ICMP6_FILTER sockopt.
*/
#define ICMP6_FILTER 1
#define ICMP6_FILTER_SETPASSALL(filterp) \
(void)memset(filterp, 0xff, sizeof(struct icmp6_filter))
#define ICMP6_FILTER_SETBLOCKALL(filterp) \
(void)memset(filterp, 0x00, sizeof(struct icmp6_filter))
#define ICMP6_FILTER_SETBLOCKALL(filterp) \
(void)memset(filterp, 0xff, sizeof(struct icmp6_filter))
#define ICMP6_FILTER_SETPASS(type, filterp) \
(((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))
#define ICMP6_FILTER_SETBLOCK(type, filterp) \
(((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))
#define ICMP6_FILTER_SETBLOCK(type, filterp) \
(((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))
#define ICMP6_FILTER_WILLPASS(type, filterp) \
((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
#define ICMP6_FILTER_WILLBLOCK(type, filterp) \
((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
#define ICMP6_FILTER_WILLBLOCK(type, filterp) \
((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
/*
* END android-changed
*/
/*
* Variables related to this implementation