diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/etherdevice.h | 23 | ||||
| -rw-r--r-- | include/linux/netfilter/x_tables.h | 4 | ||||
| -rw-r--r-- | include/linux/netfilter_bridge/ebtables.h | 2 |
3 files changed, 27 insertions, 2 deletions
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 37ff4a6faa9a..6fec9e81bd70 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
| @@ -374,6 +374,29 @@ static inline bool ether_addr_equal_unaligned(const u8 *addr1, const u8 *addr2) | |||
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | /** | 376 | /** |
| 377 | * ether_addr_equal_masked - Compare two Ethernet addresses with a mask | ||
| 378 | * @addr1: Pointer to a six-byte array containing the 1st Ethernet address | ||
| 379 | * @addr2: Pointer to a six-byte array containing the 2nd Ethernet address | ||
| 380 | * @mask: Pointer to a six-byte array containing the Ethernet address bitmask | ||
| 381 | * | ||
| 382 | * Compare two Ethernet addresses with a mask, returns true if for every bit | ||
| 383 | * set in the bitmask the equivalent bits in the ethernet addresses are equal. | ||
| 384 | * Using a mask with all bits set is a slower ether_addr_equal. | ||
| 385 | */ | ||
| 386 | static inline bool ether_addr_equal_masked(const u8 *addr1, const u8 *addr2, | ||
| 387 | const u8 *mask) | ||
| 388 | { | ||
| 389 | int i; | ||
| 390 | |||
| 391 | for (i = 0; i < ETH_ALEN; i++) { | ||
| 392 | if ((addr1[i] ^ addr2[i]) & mask[i]) | ||
| 393 | return false; | ||
| 394 | } | ||
| 395 | |||
| 396 | return true; | ||
| 397 | } | ||
| 398 | |||
| 399 | /** | ||
| 377 | * is_etherdev_addr - Tell if given Ethernet address belongs to the device. | 400 | * is_etherdev_addr - Tell if given Ethernet address belongs to the device. |
| 378 | * @dev: Pointer to a device structure | 401 | * @dev: Pointer to a device structure |
| 379 | * @addr: Pointer to a six-byte array containing the Ethernet address | 402 | * @addr: Pointer to a six-byte array containing the Ethernet address |
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index dc4f58a3cdcc..e94e81ab2b58 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
| @@ -6,6 +6,10 @@ | |||
| 6 | #include <linux/static_key.h> | 6 | #include <linux/static_key.h> |
| 7 | #include <uapi/linux/netfilter/x_tables.h> | 7 | #include <uapi/linux/netfilter/x_tables.h> |
| 8 | 8 | ||
| 9 | /* Test a struct->invflags and a boolean for inequality */ | ||
| 10 | #define NF_INVF(ptr, flag, boolean) \ | ||
| 11 | ((boolean) ^ !!((ptr)->invflags & (flag))) | ||
| 12 | |||
| 9 | /** | 13 | /** |
| 10 | * struct xt_action_param - parameters for matches/targets | 14 | * struct xt_action_param - parameters for matches/targets |
| 11 | * | 15 | * |
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h index 2ea517c7c6b9..984b2112c77b 100644 --- a/include/linux/netfilter_bridge/ebtables.h +++ b/include/linux/netfilter_bridge/ebtables.h | |||
| @@ -115,8 +115,6 @@ extern unsigned int ebt_do_table(struct sk_buff *skb, | |||
| 115 | const struct nf_hook_state *state, | 115 | const struct nf_hook_state *state, |
| 116 | struct ebt_table *table); | 116 | struct ebt_table *table); |
| 117 | 117 | ||
| 118 | /* Used in the kernel match() functions */ | ||
| 119 | #define FWINV(bool,invflg) ((bool) ^ !!(info->invflags & invflg)) | ||
| 120 | /* True if the hook mask denotes that the rule is in a base chain, | 118 | /* True if the hook mask denotes that the rule is in a base chain, |
| 121 | * used in the check() functions */ | 119 | * used in the check() functions */ |
| 122 | #define BASE_CHAIN (par->hook_mask & (1 << NF_BR_NUMHOOKS)) | 120 | #define BASE_CHAIN (par->hook_mask & (1 << NF_BR_NUMHOOKS)) |
