We already have ICMPv6 type/code matches. This adds support for IPv4 ICMP matches in the same way.
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -24,8 +24,9 @@ · 23 unmodified lines | ||
| 24 | 24 | #define EBT_IP_PROTO 0x08 |
| 25 | 25 | #define EBT_IP_SPORT 0x10 |
| 26 | 26 | #define EBT_IP_DPORT 0x20 |
| 27 | +#define EBT_IP_ICMP 0x40 | |
| 27 | 28 | #define EBT_IP_MASK (EBT_IP_SOURCE | EBT_IP_DEST | EBT_IP_TOS | EBT_IP_PROTO |\ |
| 28 | − EBT_IP_SPORT | EBT_IP_DPORT ) | |
| 29 | + EBT_IP_SPORT | EBT_IP_DPORT | EBT_IP_ICMP) | |
| 29 | 30 | #define EBT_IP_MATCH "ip" |
| 30 | 31 | |
| 31 | 32 | /* the same values are used for the invflags */ |
| @@ -38,8 +39,14 @@ struct ebt_ip_info { · 6 unmodified lines | ||
| 38 | 39 | __u8 protocol; |
| 39 | 40 | __u8 bitmask; |
| 40 | 41 | __u8 invflags; |
| 41 | − __u16 sport[2]; | |
| 42 | − __u16 dport[2]; | |
| 42 | + union { | |
| 43 | + __u16 sport[2]; | |
| 44 | + __u8 icmp_type[2]; | |
| 45 | + }; | |
| 46 | + union { | |
| 47 | + __u16 dport[2]; | |
| 48 | + __u8 icmp_code[2]; | |
| 49 | + }; | |
| 43 | 50 | }; |
| 44 | 51 | |
| 45 | 52 | #endif |