Pablo Neira Ayuso says: ==================== Netfilter/IPVS updates for net-next The following patchset contains Netfilter/IPVS updates for your net-next tree. This batch comes with more input sanitization for xtables to address bug reports from fuzzers, preparation works to the flowtable infrastructure and assorted updates. In no particular order, they are: 1) Make sure userspace provides a valid standard target verdict, from Florian Westphal. 2) Sanitize error target size, also from Florian. 3) Validate that last rule in basechain matches underflow/policy since userspace assumes this when decoding the ruleset blob that comes from the kernel, from Florian. 4) Consolidate hook entry checks through xt_check_table_hooks(), patch from Florian. 5) Cap ruleset allocations at 512 mbytes, 134217728 rules and reject very large compat offset arrays, so we have a reasonable upper limit and fuzzers don't exercise the oom-killer. Patches from Florian. 6) Several WARN_ON checks on xtables mutex helper, from Florian. 7) xt_rateest now has a hashtable per net, from Cong Wang. 8) Consolidate counter allocation in xt_counters_alloc(), from Florian. 9) Earlier xt_table_unlock() call in {ip,ip6,arp,eb}tables, patch from Xin Long. 10) Set FLOW_OFFLOAD_DIR_* to IP_CT_DIR_* definitions, patch from Felix Fietkau. 11) Consolidate code through flow_offload_fill_dir(), also from Felix. 12) Inline ip6_dst_mtu_forward() just like ip_dst_mtu_maybe_forward() to remove a dependency with flowtable and ipv6.ko, from Felix. 13) Cache mtu size in flow_offload_tuple object, this is safe for forwarding as f87c10a8aa1e describes, from Felix. 14) Rename nf_flow_table.c to nf_flow_table_core.o, to simplify too modular infrastructure, from Felix. 15) Add rt0, rt2 and rt4 IPv6 routing extension support, patch from Ahmed Abdelsalam. 16) Remove unused parameter in nf_conncount_count(), from Yi-Hung Wei. 17) Support for counting only to nf_conncount infrastructure, patch from Yi-Hung Wei. 18) Add strict NFT_CT_{SRC_IP,DST_IP,SRC_IP6,DST_IP6} key datatypes to nft_ct. 19) Use boolean as return value from ipt_ah and from IPVS too, patch from Gustavo A. R. Silva. 20) Remove useless parameters in nfnl_acct_overquota() and nf_conntrack_broadcast_help(), from Taehee Yoo. 21) Use ipv6_addr_is_multicast() from xt_cluster, also from Taehee Yoo. 22) Statify nf_tables_obj_lookup_byhandle, patch from Fengguang Wu. 23) Fix typo in xt_limit, from Geert Uytterhoeven. 24) Do no use VLAs in Netfilter code, again from Gustavo. 25) Use ADD_COUNTER from ebtables, from Taehee Yoo. 26) Bitshift support for CONNMARK and MARK targets, from Jack Ma. 27) Use pr_*() and add pr_fmt(), from Arushi Singhal. 28) Add synproxy support to ctnetlink. 29) ICMP type and IGMP matching support for ebtables, patches from Matthias Schiffer. 30) Support for the revision infrastructure to ebtables, from Bernie Harris. 31) String match support for ebtables, also from Bernie. 32) Documentation for the new flowtable infrastructure. 33) Use generic comparison functions in ebt_stp, from Joe Perches. 34) Demodularize filter chains in nftables. 35) Register conntrack hooks in case nftables NAT chain is added. 36) Merge assignments with return in a couple of spots in the Netfilter codebase, also from Arushi. 37) Document that xtables percpu counters are stored in the same memory area, from Ben Hutchings. 38) Revert mark_source_chains() sanity checks that break existing rulesets, from Florian Westphal. 39) Use is_zero_ether_addr() in the ipset codebase, from Joe Perches. ====================
Showing the changes to include/uapi/linux (6 of 75 files). Show all
Unified · Split
| @@ -129,6 +129,7 @@ enum ip_conntrack_events { · 128 unmodified lines | |||
| 129 | IPCT_NATSEQADJ = IPCT_SEQADJ, | 129 | IPCT_NATSEQADJ = IPCT_SEQADJ, |
| 130 | IPCT_SECMARK, /* new security mark has been set */ | 130 | IPCT_SECMARK, /* new security mark has been set */ |
| 131 | IPCT_LABEL, /* new connlabel has been set */ | 131 | IPCT_LABEL, /* new connlabel has been set */ |
| 132 | IPCT_SYNPROXY, /* synproxy has been set */ | ||
| 132 | #ifdef __KERNEL__ | 133 | #ifdef __KERNEL__ |
| 133 | __IPCT_MAX | 134 | __IPCT_MAX |
| 134 | #endif | 135 | #endif |
| @@ -909,8 +909,8 @@ enum nft_rt_attributes { · 908 unmodified lines | |||
| 909 | * @NFT_CT_EXPIRATION: relative conntrack expiration time in ms | 909 | * @NFT_CT_EXPIRATION: relative conntrack expiration time in ms |
| 910 | * @NFT_CT_HELPER: connection tracking helper assigned to conntrack | 910 | * @NFT_CT_HELPER: connection tracking helper assigned to conntrack |
| 911 | * @NFT_CT_L3PROTOCOL: conntrack layer 3 protocol | 911 | * @NFT_CT_L3PROTOCOL: conntrack layer 3 protocol |
| 912 | * @NFT_CT_SRC: conntrack layer 3 protocol source (IPv4/IPv6 address) | 912 | * @NFT_CT_SRC: conntrack layer 3 protocol source (IPv4/IPv6 address, deprecated) |
| 913 | * @NFT_CT_DST: conntrack layer 3 protocol destination (IPv4/IPv6 address) | 913 | * @NFT_CT_DST: conntrack layer 3 protocol destination (IPv4/IPv6 address, deprecated) |
| 914 | * @NFT_CT_PROTOCOL: conntrack layer 4 protocol | 914 | * @NFT_CT_PROTOCOL: conntrack layer 4 protocol |
| 915 | * @NFT_CT_PROTO_SRC: conntrack layer 4 protocol source | 915 | * @NFT_CT_PROTO_SRC: conntrack layer 4 protocol source |
| 916 | * @NFT_CT_PROTO_DST: conntrack layer 4 protocol destination | 916 | * @NFT_CT_PROTO_DST: conntrack layer 4 protocol destination |
| @@ -920,6 +920,10 @@ enum nft_rt_attributes { · 3 unmodified lines | |||
| 920 | * @NFT_CT_AVGPKT: conntrack average bytes per packet | 920 | * @NFT_CT_AVGPKT: conntrack average bytes per packet |
| 921 | * @NFT_CT_ZONE: conntrack zone | 921 | * @NFT_CT_ZONE: conntrack zone |
| 922 | * @NFT_CT_EVENTMASK: ctnetlink events to be generated for this conntrack | 922 | * @NFT_CT_EVENTMASK: ctnetlink events to be generated for this conntrack |
| 923 | * @NFT_CT_SRC_IP: conntrack layer 3 protocol source (IPv4 address) | ||
| 924 | * @NFT_CT_DST_IP: conntrack layer 3 protocol destination (IPv4 address) | ||
| 925 | * @NFT_CT_SRC_IP6: conntrack layer 3 protocol source (IPv6 address) | ||
| 926 | * @NFT_CT_DST_IP6: conntrack layer 3 protocol destination (IPv6 address) | ||
| 923 | */ | 927 | */ |
| 924 | enum nft_ct_keys { | 928 | enum nft_ct_keys { |
| 925 | NFT_CT_STATE, | 929 | NFT_CT_STATE, |
| @@ -941,6 +945,10 @@ enum nft_ct_keys { · 15 unmodified lines | |||
| 941 | NFT_CT_AVGPKT, | 945 | NFT_CT_AVGPKT, |
| 942 | NFT_CT_ZONE, | 946 | NFT_CT_ZONE, |
| 943 | NFT_CT_EVENTMASK, | 947 | NFT_CT_EVENTMASK, |
| 948 | NFT_CT_SRC_IP, | ||
| 949 | NFT_CT_DST_IP, | ||
| 950 | NFT_CT_SRC_IP6, | ||
| 951 | NFT_CT_DST_IP6, | ||
| 944 | }; | 952 | }; |
| 945 | 953 | ||
| 946 | /** | 954 | /** |
| @@ -54,6 +54,7 @@ enum ctattr_type { · 53 unmodified lines | |||
| 54 | CTA_MARK_MASK, | 54 | CTA_MARK_MASK, |
| 55 | CTA_LABELS, | 55 | CTA_LABELS, |
| 56 | CTA_LABELS_MASK, | 56 | CTA_LABELS_MASK, |
| 57 | CTA_SYNPROXY, | ||
| 57 | __CTA_MAX | 58 | __CTA_MAX |
| 58 | }; | 59 | }; |
| 59 | #define CTA_MAX (__CTA_MAX - 1) | 60 | #define CTA_MAX (__CTA_MAX - 1) |
| @@ -190,6 +191,15 @@ enum ctattr_natseq { · 130 unmodified lines | |||
| 190 | }; | 191 | }; |
| 191 | #define CTA_NAT_SEQ_MAX (__CTA_NAT_SEQ_MAX - 1) | 192 | #define CTA_NAT_SEQ_MAX (__CTA_NAT_SEQ_MAX - 1) |
| 192 | 193 | ||
| 194 | enum ctattr_synproxy { | ||
| 195 | CTA_SYNPROXY_UNSPEC, | ||
| 196 | CTA_SYNPROXY_ISN, | ||
| 197 | CTA_SYNPROXY_ITS, | ||
| 198 | CTA_SYNPROXY_TSOFF, | ||
| 199 | __CTA_SYNPROXY_MAX, | ||
| 200 | }; | ||
| 201 | #define CTA_SYNPROXY_MAX (__CTA_SYNPROXY_MAX - 1) | ||
| 202 | |||
| 193 | enum ctattr_expect { | 203 | enum ctattr_expect { |
| 194 | CTA_EXPECT_UNSPEC, | 204 | CTA_EXPECT_UNSPEC, |
| 195 | CTA_EXPECT_MASTER, | 205 | CTA_EXPECT_MASTER, |
| @@ -19,11 +19,21 @@ enum { · 18 unmodified lines | |||
| 19 | XT_CONNMARK_RESTORE | 19 | XT_CONNMARK_RESTORE |
| 20 | }; | 20 | }; |
| 21 | 21 | ||
| 22 | enum { | ||
| 23 | D_SHIFT_LEFT = 0, | ||
| 24 | D_SHIFT_RIGHT, | ||
| 25 | }; | ||
| 26 | |||
| 22 | struct xt_connmark_tginfo1 { | 27 | struct xt_connmark_tginfo1 { |
| 23 | __u32 ctmark, ctmask, nfmask; | 28 | __u32 ctmark, ctmask, nfmask; |
| 24 | __u8 mode; | 29 | __u8 mode; |
| 25 | }; | 30 | }; |
| 26 | 31 | ||
| 32 | struct xt_connmark_tginfo2 { | ||
| 33 | __u32 ctmark, ctmask, nfmask; | ||
| 34 | __u8 shift_dir, shift_bits, mode; | ||
| 35 | }; | ||
| 36 | |||
| 27 | struct xt_connmark_mtinfo1 { | 37 | struct xt_connmark_mtinfo1 { |
| 28 | __u32 mark, mask; | 38 | __u32 mark, mask; |
| 29 | __u8 invert; | 39 | __u8 invert; |
| @@ -24,8 +24,10 @@ · 23 unmodified lines | |||
| 24 | #define EBT_IP_PROTO 0x08 | 24 | #define EBT_IP_PROTO 0x08 |
| 25 | #define EBT_IP_SPORT 0x10 | 25 | #define EBT_IP_SPORT 0x10 |
| 26 | #define EBT_IP_DPORT 0x20 | 26 | #define EBT_IP_DPORT 0x20 |
| 27 | #define EBT_IP_ICMP 0x40 | ||
| 28 | #define EBT_IP_IGMP 0x80 | ||
| 27 | #define EBT_IP_MASK (EBT_IP_SOURCE | EBT_IP_DEST | EBT_IP_TOS | EBT_IP_PROTO |\ | 29 | #define EBT_IP_MASK (EBT_IP_SOURCE | EBT_IP_DEST | EBT_IP_TOS | EBT_IP_PROTO |\ |
| 28 | EBT_IP_SPORT | EBT_IP_DPORT ) | 30 | EBT_IP_SPORT | EBT_IP_DPORT | EBT_IP_ICMP | EBT_IP_IGMP) |
| 29 | #define EBT_IP_MATCH "ip" | 31 | #define EBT_IP_MATCH "ip" |
| 30 | 32 | ||
| 31 | /* the same values are used for the invflags */ | 33 | /* the same values are used for the invflags */ |
| @@ -38,8 +40,15 @@ struct ebt_ip_info { · 6 unmodified lines | |||
| 38 | __u8 protocol; | 40 | __u8 protocol; |
| 39 | __u8 bitmask; | 41 | __u8 bitmask; |
| 40 | __u8 invflags; | 42 | __u8 invflags; |
| 41 | __u16 sport[2]; | 43 | union { |
| 42 | __u16 dport[2]; | 44 | __u16 sport[2]; |
| 45 | __u8 icmp_type[2]; | ||
| 46 | __u8 igmp_type[2]; | ||
| 47 | }; | ||
| 48 | union { | ||
| 49 | __u16 dport[2]; | ||
| 50 | __u8 icmp_code[2]; | ||
| 51 | }; | ||
| 43 | }; | 52 | }; |
| 44 | 53 | ||
| 45 | #endif | 54 | #endif |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | |||
| 20 | #define EBT_TABLE_MAXNAMELEN 32 | 20 | #define EBT_TABLE_MAXNAMELEN 32 |
| 21 | #define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN | 21 | #define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN |
| 22 | #define EBT_FUNCTION_MAXNAMELEN EBT_TABLE_MAXNAMELEN | 22 | #define EBT_FUNCTION_MAXNAMELEN EBT_TABLE_MAXNAMELEN |
| 23 | #define EBT_EXTENSION_MAXNAMELEN 31 | ||
| 23 | 24 | ||
| 24 | /* verdicts >0 are "branches" */ | 25 | /* verdicts >0 are "branches" */ |
| 25 | #define EBT_ACCEPT -1 | 26 | #define EBT_ACCEPT -1 |
| @@ -120,7 +121,10 @@ struct ebt_entries { · 94 unmodified lines | |||
| 120 | 121 | ||
| 121 | struct ebt_entry_match { | 122 | struct ebt_entry_match { |
| 122 | union { | 123 | union { |
| 123 | char name[EBT_FUNCTION_MAXNAMELEN]; | 124 | struct { |
| 125 | char name[EBT_EXTENSION_MAXNAMELEN]; | ||
| 126 | uint8_t revision; | ||
| 127 | }; | ||
| 124 | struct xt_match *match; | 128 | struct xt_match *match; |
| 125 | } u; | 129 | } u; |
| 126 | /* size of data */ | 130 | /* size of data */ |
| @@ -130,7 +134,10 @@ struct ebt_entry_match { · 3 unmodified lines | |||
| 130 | 134 | ||
| 131 | struct ebt_entry_watcher { | 135 | struct ebt_entry_watcher { |
| 132 | union { | 136 | union { |
| 133 | char name[EBT_FUNCTION_MAXNAMELEN]; | 137 | struct { |
| 138 | char name[EBT_EXTENSION_MAXNAMELEN]; | ||
| 139 | uint8_t revision; | ||
| 140 | }; | ||
| 134 | struct xt_target *watcher; | 141 | struct xt_target *watcher; |
| 135 | } u; | 142 | } u; |
| 136 | /* size of data */ | 143 | /* size of data */ |
| @@ -140,7 +147,10 @@ struct ebt_entry_watcher { · 3 unmodified lines | |||
| 140 | 147 | ||
| 141 | struct ebt_entry_target { | 148 | struct ebt_entry_target { |
| 142 | union { | 149 | union { |
| 143 | char name[EBT_FUNCTION_MAXNAMELEN]; | 150 | struct { |
| 151 | char name[EBT_EXTENSION_MAXNAMELEN]; | ||
| 152 | uint8_t revision; | ||
| 153 | }; | ||
| 144 | struct xt_target *target; | 154 | struct xt_target *target; |
| 145 | } u; | 155 | } u; |
| 146 | /* size of data */ | 156 | /* size of data */ |