aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/netfilter/ipset/ip_set_ahash.h4
-rw-r--r--include/linux/netfilter/ipset/ip_set_timeout.h18
-rw-r--r--include/net/ip_vs.h3
-rw-r--r--net/bridge/netfilter/ebtables.c6
-rw-r--r--net/netfilter/ipset/ip_set_core.c2
-rw-r--r--net/netfilter/ipvs/ip_vs_ftp.c27
6 files changed, 38 insertions, 22 deletions
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h
index a0196ac79051..ac3c822eb39a 100644
--- a/include/linux/netfilter/ipset/ip_set_ahash.h
+++ b/include/linux/netfilter/ipset/ip_set_ahash.h
@@ -839,7 +839,7 @@ type_pf_tdel(struct ip_set *set, void *value, u32 timeout)
839 struct htable *t = h->table; 839 struct htable *t = h->table;
840 const struct type_pf_elem *d = value; 840 const struct type_pf_elem *d = value;
841 struct hbucket *n; 841 struct hbucket *n;
842 int i, ret = 0; 842 int i;
843 struct type_pf_elem *data; 843 struct type_pf_elem *data;
844 u32 key; 844 u32 key;
845 845
@@ -850,7 +850,7 @@ type_pf_tdel(struct ip_set *set, void *value, u32 timeout)
850 if (!type_pf_data_equal(data, d)) 850 if (!type_pf_data_equal(data, d))
851 continue; 851 continue;
852 if (type_pf_data_expired(data)) 852 if (type_pf_data_expired(data))
853 ret = -IPSET_ERR_EXIST; 853 return -IPSET_ERR_EXIST;
854 if (i != n->pos - 1) 854 if (i != n->pos - 1)
855 /* Not last one */ 855 /* Not last one */
856 type_pf_data_copy(data, ahash_tdata(n, n->pos - 1)); 856 type_pf_data_copy(data, ahash_tdata(n, n->pos - 1));
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h
index 9f30c5f2ec1c..bcdd40ad39ed 100644
--- a/include/linux/netfilter/ipset/ip_set_timeout.h
+++ b/include/linux/netfilter/ipset/ip_set_timeout.h
@@ -45,7 +45,7 @@ ip_set_timeout_test(unsigned long timeout)
45{ 45{
46 return timeout != IPSET_ELEM_UNSET && 46 return timeout != IPSET_ELEM_UNSET &&
47 (timeout == IPSET_ELEM_PERMANENT || 47 (timeout == IPSET_ELEM_PERMANENT ||
48 time_after(timeout, jiffies)); 48 time_is_after_jiffies(timeout));
49} 49}
50 50
51static inline bool 51static inline bool
@@ -53,7 +53,7 @@ ip_set_timeout_expired(unsigned long timeout)
53{ 53{
54 return timeout != IPSET_ELEM_UNSET && 54 return timeout != IPSET_ELEM_UNSET &&
55 timeout != IPSET_ELEM_PERMANENT && 55 timeout != IPSET_ELEM_PERMANENT &&
56 time_before(timeout, jiffies); 56 time_is_before_jiffies(timeout);
57} 57}
58 58
59static inline unsigned long 59static inline unsigned long
@@ -64,7 +64,7 @@ ip_set_timeout_set(u32 timeout)
64 if (!timeout) 64 if (!timeout)
65 return IPSET_ELEM_PERMANENT; 65 return IPSET_ELEM_PERMANENT;
66 66
67 t = timeout * HZ + jiffies; 67 t = msecs_to_jiffies(timeout * 1000) + jiffies;
68 if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT) 68 if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT)
69 /* Bingo! */ 69 /* Bingo! */
70 t++; 70 t++;
@@ -75,7 +75,8 @@ ip_set_timeout_set(u32 timeout)
75static inline u32 75static inline u32
76ip_set_timeout_get(unsigned long timeout) 76ip_set_timeout_get(unsigned long timeout)
77{ 77{
78 return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ; 78 return timeout == IPSET_ELEM_PERMANENT ? 0 :
79 jiffies_to_msecs(timeout - jiffies)/1000;
79} 80}
80 81
81#else 82#else
@@ -89,14 +90,14 @@ static inline bool
89ip_set_timeout_test(unsigned long timeout) 90ip_set_timeout_test(unsigned long timeout)
90{ 91{
91 return timeout == IPSET_ELEM_PERMANENT || 92 return timeout == IPSET_ELEM_PERMANENT ||
92 time_after(timeout, jiffies); 93 time_is_after_jiffies(timeout);
93} 94}
94 95
95static inline bool 96static inline bool
96ip_set_timeout_expired(unsigned long timeout) 97ip_set_timeout_expired(unsigned long timeout)
97{ 98{
98 return timeout != IPSET_ELEM_PERMANENT && 99 return timeout != IPSET_ELEM_PERMANENT &&
99 time_before(timeout, jiffies); 100 time_is_before_jiffies(timeout);
100} 101}
101 102
102static inline unsigned long 103static inline unsigned long
@@ -107,7 +108,7 @@ ip_set_timeout_set(u32 timeout)
107 if (!timeout) 108 if (!timeout)
108 return IPSET_ELEM_PERMANENT; 109 return IPSET_ELEM_PERMANENT;
109 110
110 t = timeout * HZ + jiffies; 111 t = msecs_to_jiffies(timeout * 1000) + jiffies;
111 if (t == IPSET_ELEM_PERMANENT) 112 if (t == IPSET_ELEM_PERMANENT)
112 /* Bingo! :-) */ 113 /* Bingo! :-) */
113 t++; 114 t++;
@@ -118,7 +119,8 @@ ip_set_timeout_set(u32 timeout)
118static inline u32 119static inline u32
119ip_set_timeout_get(unsigned long timeout) 120ip_set_timeout_get(unsigned long timeout)
120{ 121{
121 return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ; 122 return timeout == IPSET_ELEM_PERMANENT ? 0 :
123 jiffies_to_msecs(timeout - jiffies)/1000;
122} 124}
123#endif /* ! IP_SET_BITMAP_TIMEOUT */ 125#endif /* ! IP_SET_BITMAP_TIMEOUT */
124 126
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 4fff432aeade..481f856c650f 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -797,7 +797,8 @@ struct netns_ipvs {
797 struct list_head rs_table[IP_VS_RTAB_SIZE]; 797 struct list_head rs_table[IP_VS_RTAB_SIZE];
798 /* ip_vs_app */ 798 /* ip_vs_app */
799 struct list_head app_list; 799 struct list_head app_list;
800 800 /* ip_vs_ftp */
801 struct ip_vs_app *ftp_app;
801 /* ip_vs_proto */ 802 /* ip_vs_proto */
802 #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */ 803 #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
803 struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE]; 804 struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE];
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 1a92b369c820..2b5ca1a0054d 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -1883,14 +1883,13 @@ static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt,
1883 struct xt_target *wt; 1883 struct xt_target *wt;
1884 void *dst = NULL; 1884 void *dst = NULL;
1885 int off, pad = 0; 1885 int off, pad = 0;
1886 unsigned int size_kern, entry_offset, match_size = mwt->match_size; 1886 unsigned int size_kern, match_size = mwt->match_size;
1887 1887
1888 strlcpy(name, mwt->u.name, sizeof(name)); 1888 strlcpy(name, mwt->u.name, sizeof(name));
1889 1889
1890 if (state->buf_kern_start) 1890 if (state->buf_kern_start)
1891 dst = state->buf_kern_start + state->buf_kern_offset; 1891 dst = state->buf_kern_start + state->buf_kern_offset;
1892 1892
1893 entry_offset = (unsigned char *) mwt - base;
1894 switch (compat_mwt) { 1893 switch (compat_mwt) {
1895 case EBT_COMPAT_MATCH: 1894 case EBT_COMPAT_MATCH:
1896 match = try_then_request_module(xt_find_match(NFPROTO_BRIDGE, 1895 match = try_then_request_module(xt_find_match(NFPROTO_BRIDGE,
@@ -1933,6 +1932,9 @@ static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt,
1933 size_kern = wt->targetsize; 1932 size_kern = wt->targetsize;
1934 module_put(wt->me); 1933 module_put(wt->me);
1935 break; 1934 break;
1935
1936 default:
1937 return -EINVAL;
1936 } 1938 }
1937 1939
1938 state->buf_kern_offset += match_size + off; 1940 state->buf_kern_offset += match_size + off;
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index 72d1ac611fdc..8041befc6555 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -815,7 +815,7 @@ ip_set_flush(struct sock *ctnl, struct sk_buff *skb,
815 ip_set_id_t i; 815 ip_set_id_t i;
816 816
817 if (unlikely(protocol_failed(attr))) 817 if (unlikely(protocol_failed(attr)))
818 return -EPROTO; 818 return -IPSET_ERR_PROTOCOL;
819 819
820 if (!attr[IPSET_ATTR_SETNAME]) { 820 if (!attr[IPSET_ATTR_SETNAME]) {
821 for (i = 0; i < ip_set_max; i++) 821 for (i = 0; i < ip_set_max; i++)
diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c
index 6b5dd6ddaae9..af63553fa332 100644
--- a/net/netfilter/ipvs/ip_vs_ftp.c
+++ b/net/netfilter/ipvs/ip_vs_ftp.c
@@ -411,25 +411,35 @@ static struct ip_vs_app ip_vs_ftp = {
411static int __net_init __ip_vs_ftp_init(struct net *net) 411static int __net_init __ip_vs_ftp_init(struct net *net)
412{ 412{
413 int i, ret; 413 int i, ret;
414 struct ip_vs_app *app = &ip_vs_ftp; 414 struct ip_vs_app *app;
415 struct netns_ipvs *ipvs = net_ipvs(net);
416
417 app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL);
418 if (!app)
419 return -ENOMEM;
420 INIT_LIST_HEAD(&app->a_list);
421 INIT_LIST_HEAD(&app->incs_list);
422 ipvs->ftp_app = app;
415 423
416 ret = register_ip_vs_app(net, app); 424 ret = register_ip_vs_app(net, app);
417 if (ret) 425 if (ret)
418 return ret; 426 goto err_exit;
419 427
420 for (i=0; i<IP_VS_APP_MAX_PORTS; i++) { 428 for (i=0; i<IP_VS_APP_MAX_PORTS; i++) {
421 if (!ports[i]) 429 if (!ports[i])
422 continue; 430 continue;
423 ret = register_ip_vs_app_inc(net, app, app->protocol, ports[i]); 431 ret = register_ip_vs_app_inc(net, app, app->protocol, ports[i]);
424 if (ret) 432 if (ret)
425 break; 433 goto err_unreg;
426 pr_info("%s: loaded support on port[%d] = %d\n", 434 pr_info("%s: loaded support on port[%d] = %d\n",
427 app->name, i, ports[i]); 435 app->name, i, ports[i]);
428 } 436 }
437 return 0;
429 438
430 if (ret) 439err_unreg:
431 unregister_ip_vs_app(net, app); 440 unregister_ip_vs_app(net, app);
432 441err_exit:
442 kfree(ipvs->ftp_app);
433 return ret; 443 return ret;
434} 444}
435/* 445/*
@@ -437,9 +447,10 @@ static int __net_init __ip_vs_ftp_init(struct net *net)
437 */ 447 */
438static void __ip_vs_ftp_exit(struct net *net) 448static void __ip_vs_ftp_exit(struct net *net)
439{ 449{
440 struct ip_vs_app *app = &ip_vs_ftp; 450 struct netns_ipvs *ipvs = net_ipvs(net);
441 451
442 unregister_ip_vs_app(net, app); 452 unregister_ip_vs_app(net, ipvs->ftp_app);
453 kfree(ipvs->ftp_app);
443} 454}
444 455
445static struct pernet_operations ip_vs_ftp_ops = { 456static struct pernet_operations ip_vs_ftp_ops = {