diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/bridge/netfilter/ebtables.c | 64 | ||||
| -rw-r--r-- | net/ipv6/netfilter/ip6t_REJECT.c | 4 | ||||
| -rw-r--r-- | net/netfilter/ipvs/ip_vs_app.c | 15 | ||||
| -rw-r--r-- | net/netfilter/ipvs/ip_vs_conn.c | 12 | ||||
| -rw-r--r-- | net/netfilter/ipvs/ip_vs_core.c | 103 | ||||
| -rw-r--r-- | net/netfilter/ipvs/ip_vs_ctl.c | 120 | ||||
| -rw-r--r-- | net/netfilter/ipvs/ip_vs_est.c | 14 | ||||
| -rw-r--r-- | net/netfilter/ipvs/ip_vs_proto.c | 11 | ||||
| -rw-r--r-- | net/netfilter/ipvs/ip_vs_sync.c | 65 | ||||
| -rw-r--r-- | net/netfilter/nf_conntrack_netlink.c | 4 | ||||
| -rw-r--r-- | net/netfilter/x_tables.c | 4 | ||||
| -rw-r--r-- | net/netfilter/xt_DSCP.c | 2 | ||||
| -rw-r--r-- | net/netfilter/xt_conntrack.c | 5 |
13 files changed, 262 insertions, 161 deletions
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 893669caa8de..1a92b369c820 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
| @@ -1766,7 +1766,7 @@ static int compat_table_info(const struct ebt_table_info *info, | |||
| 1766 | 1766 | ||
| 1767 | newinfo->entries_size = size; | 1767 | newinfo->entries_size = size; |
| 1768 | 1768 | ||
| 1769 | xt_compat_init_offsets(AF_INET, info->nentries); | 1769 | xt_compat_init_offsets(NFPROTO_BRIDGE, info->nentries); |
| 1770 | return EBT_ENTRY_ITERATE(entries, size, compat_calc_entry, info, | 1770 | return EBT_ENTRY_ITERATE(entries, size, compat_calc_entry, info, |
| 1771 | entries, newinfo); | 1771 | entries, newinfo); |
| 1772 | } | 1772 | } |
| @@ -1882,7 +1882,7 @@ static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt, | |||
| 1882 | struct xt_match *match; | 1882 | struct xt_match *match; |
| 1883 | struct xt_target *wt; | 1883 | struct xt_target *wt; |
| 1884 | void *dst = NULL; | 1884 | void *dst = NULL; |
| 1885 | int off, pad = 0, ret = 0; | 1885 | int off, pad = 0; |
| 1886 | unsigned int size_kern, entry_offset, match_size = mwt->match_size; | 1886 | unsigned int size_kern, entry_offset, match_size = mwt->match_size; |
| 1887 | 1887 | ||
| 1888 | strlcpy(name, mwt->u.name, sizeof(name)); | 1888 | strlcpy(name, mwt->u.name, sizeof(name)); |
| @@ -1935,13 +1935,6 @@ static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt, | |||
| 1935 | break; | 1935 | break; |
| 1936 | } | 1936 | } |
| 1937 | 1937 | ||
| 1938 | if (!dst) { | ||
| 1939 | ret = xt_compat_add_offset(NFPROTO_BRIDGE, entry_offset, | ||
| 1940 | off + ebt_compat_entry_padsize()); | ||
| 1941 | if (ret < 0) | ||
| 1942 | return ret; | ||
| 1943 | } | ||
| 1944 | |||
| 1945 | state->buf_kern_offset += match_size + off; | 1938 | state->buf_kern_offset += match_size + off; |
| 1946 | state->buf_user_offset += match_size; | 1939 | state->buf_user_offset += match_size; |
| 1947 | pad = XT_ALIGN(size_kern) - size_kern; | 1940 | pad = XT_ALIGN(size_kern) - size_kern; |
| @@ -2016,50 +2009,6 @@ static int ebt_size_mwt(struct compat_ebt_entry_mwt *match32, | |||
| 2016 | return growth; | 2009 | return growth; |
| 2017 | } | 2010 | } |
| 2018 | 2011 | ||
| 2019 | #define EBT_COMPAT_WATCHER_ITERATE(e, fn, args...) \ | ||
| 2020 | ({ \ | ||
| 2021 | unsigned int __i; \ | ||
| 2022 | int __ret = 0; \ | ||
| 2023 | struct compat_ebt_entry_mwt *__watcher; \ | ||
| 2024 | \ | ||
| 2025 | for (__i = e->watchers_offset; \ | ||
| 2026 | __i < (e)->target_offset; \ | ||
| 2027 | __i += __watcher->watcher_size + \ | ||
| 2028 | sizeof(struct compat_ebt_entry_mwt)) { \ | ||
| 2029 | __watcher = (void *)(e) + __i; \ | ||
| 2030 | __ret = fn(__watcher , ## args); \ | ||
| 2031 | if (__ret != 0) \ | ||
| 2032 | break; \ | ||
| 2033 | } \ | ||
| 2034 | if (__ret == 0) { \ | ||
| 2035 | if (__i != (e)->target_offset) \ | ||
| 2036 | __ret = -EINVAL; \ | ||
| 2037 | } \ | ||
| 2038 | __ret; \ | ||
| 2039 | }) | ||
| 2040 | |||
| 2041 | #define EBT_COMPAT_MATCH_ITERATE(e, fn, args...) \ | ||
| 2042 | ({ \ | ||
| 2043 | unsigned int __i; \ | ||
| 2044 | int __ret = 0; \ | ||
| 2045 | struct compat_ebt_entry_mwt *__match; \ | ||
| 2046 | \ | ||
| 2047 | for (__i = sizeof(struct ebt_entry); \ | ||
| 2048 | __i < (e)->watchers_offset; \ | ||
| 2049 | __i += __match->match_size + \ | ||
| 2050 | sizeof(struct compat_ebt_entry_mwt)) { \ | ||
| 2051 | __match = (void *)(e) + __i; \ | ||
| 2052 | __ret = fn(__match , ## args); \ | ||
| 2053 | if (__ret != 0) \ | ||
| 2054 | break; \ | ||
| 2055 | } \ | ||
| 2056 | if (__ret == 0) { \ | ||
| 2057 | if (__i != (e)->watchers_offset) \ | ||
| 2058 | __ret = -EINVAL; \ | ||
| 2059 | } \ | ||
| 2060 | __ret; \ | ||
| 2061 | }) | ||
| 2062 | |||
| 2063 | /* called for all ebt_entry structures. */ | 2012 | /* called for all ebt_entry structures. */ |
| 2064 | static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base, | 2013 | static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base, |
| 2065 | unsigned int *total, | 2014 | unsigned int *total, |
| @@ -2132,6 +2081,14 @@ static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base, | |||
| 2132 | } | 2081 | } |
| 2133 | } | 2082 | } |
| 2134 | 2083 | ||
| 2084 | if (state->buf_kern_start == NULL) { | ||
| 2085 | unsigned int offset = buf_start - (char *) base; | ||
| 2086 | |||
| 2087 | ret = xt_compat_add_offset(NFPROTO_BRIDGE, offset, new_offset); | ||
| 2088 | if (ret < 0) | ||
| 2089 | return ret; | ||
| 2090 | } | ||
| 2091 | |||
| 2135 | startoff = state->buf_user_offset - startoff; | 2092 | startoff = state->buf_user_offset - startoff; |
| 2136 | 2093 | ||
| 2137 | BUG_ON(*total < startoff); | 2094 | BUG_ON(*total < startoff); |
| @@ -2240,6 +2197,7 @@ static int compat_do_replace(struct net *net, void __user *user, | |||
| 2240 | 2197 | ||
| 2241 | xt_compat_lock(NFPROTO_BRIDGE); | 2198 | xt_compat_lock(NFPROTO_BRIDGE); |
| 2242 | 2199 | ||
| 2200 | xt_compat_init_offsets(NFPROTO_BRIDGE, tmp.nentries); | ||
| 2243 | ret = compat_copy_entries(entries_tmp, tmp.entries_size, &state); | 2201 | ret = compat_copy_entries(entries_tmp, tmp.entries_size, &state); |
| 2244 | if (ret < 0) | 2202 | if (ret < 0) |
| 2245 | goto out_unlock; | 2203 | goto out_unlock; |
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c index 28e74488a329..a5a4c5dd5396 100644 --- a/net/ipv6/netfilter/ip6t_REJECT.c +++ b/net/ipv6/netfilter/ip6t_REJECT.c | |||
| @@ -45,6 +45,8 @@ static void send_reset(struct net *net, struct sk_buff *oldskb) | |||
| 45 | int tcphoff, needs_ack; | 45 | int tcphoff, needs_ack; |
| 46 | const struct ipv6hdr *oip6h = ipv6_hdr(oldskb); | 46 | const struct ipv6hdr *oip6h = ipv6_hdr(oldskb); |
| 47 | struct ipv6hdr *ip6h; | 47 | struct ipv6hdr *ip6h; |
| 48 | #define DEFAULT_TOS_VALUE 0x0U | ||
| 49 | const __u8 tclass = DEFAULT_TOS_VALUE; | ||
| 48 | struct dst_entry *dst = NULL; | 50 | struct dst_entry *dst = NULL; |
| 49 | u8 proto; | 51 | u8 proto; |
| 50 | struct flowi6 fl6; | 52 | struct flowi6 fl6; |
| @@ -124,7 +126,7 @@ static void send_reset(struct net *net, struct sk_buff *oldskb) | |||
| 124 | skb_put(nskb, sizeof(struct ipv6hdr)); | 126 | skb_put(nskb, sizeof(struct ipv6hdr)); |
| 125 | skb_reset_network_header(nskb); | 127 | skb_reset_network_header(nskb); |
| 126 | ip6h = ipv6_hdr(nskb); | 128 | ip6h = ipv6_hdr(nskb); |
| 127 | ip6h->version = 6; | 129 | *(__be32 *)ip6h = htonl(0x60000000 | (tclass << 20)); |
| 128 | ip6h->hop_limit = ip6_dst_hoplimit(dst); | 130 | ip6h->hop_limit = ip6_dst_hoplimit(dst); |
| 129 | ip6h->nexthdr = IPPROTO_TCP; | 131 | ip6h->nexthdr = IPPROTO_TCP; |
| 130 | ipv6_addr_copy(&ip6h->saddr, &oip6h->daddr); | 132 | ipv6_addr_copy(&ip6h->saddr, &oip6h->daddr); |
diff --git a/net/netfilter/ipvs/ip_vs_app.c b/net/netfilter/ipvs/ip_vs_app.c index 2dc6de13ac18..51f3af7c4743 100644 --- a/net/netfilter/ipvs/ip_vs_app.c +++ b/net/netfilter/ipvs/ip_vs_app.c | |||
| @@ -576,7 +576,7 @@ static const struct file_operations ip_vs_app_fops = { | |||
| 576 | }; | 576 | }; |
| 577 | #endif | 577 | #endif |
| 578 | 578 | ||
| 579 | static int __net_init __ip_vs_app_init(struct net *net) | 579 | int __net_init __ip_vs_app_init(struct net *net) |
| 580 | { | 580 | { |
| 581 | struct netns_ipvs *ipvs = net_ipvs(net); | 581 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 582 | 582 | ||
| @@ -585,26 +585,17 @@ static int __net_init __ip_vs_app_init(struct net *net) | |||
| 585 | return 0; | 585 | return 0; |
| 586 | } | 586 | } |
| 587 | 587 | ||
| 588 | static void __net_exit __ip_vs_app_cleanup(struct net *net) | 588 | void __net_exit __ip_vs_app_cleanup(struct net *net) |
| 589 | { | 589 | { |
| 590 | proc_net_remove(net, "ip_vs_app"); | ||
