Skip to content

Commit 58bf2db

Browse files
committed
Merge branch 'pablo/nf-2.6-updates' of git://1984.lsi.us.es/net-2.6
2 parents 86e4ca6 + c74c0bf commit 58bf2db

File tree

6 files changed

+38
-22
lines changed

6 files changed

+38
-22
lines changed

include/linux/netfilter/ipset/ip_set_ahash.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ type_pf_tdel(struct ip_set *set, void *value, u32 timeout)
839839
struct htable *t = h->table;
840840
const struct type_pf_elem *d = value;
841841
struct hbucket *n;
842-
int i, ret = 0;
842+
int i;
843843
struct type_pf_elem *data;
844844
u32 key;
845845

@@ -850,7 +850,7 @@ type_pf_tdel(struct ip_set *set, void *value, u32 timeout)
850850
if (!type_pf_data_equal(data, d))
851851
continue;
852852
if (type_pf_data_expired(data))
853-
ret = -IPSET_ERR_EXIST;
853+
return -IPSET_ERR_EXIST;
854854
if (i != n->pos - 1)
855855
/* Not last one */
856856
type_pf_data_copy(data, ahash_tdata(n, n->pos - 1));

include/linux/netfilter/ipset/ip_set_timeout.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ ip_set_timeout_test(unsigned long timeout)
4545
{
4646
return timeout != IPSET_ELEM_UNSET &&
4747
(timeout == IPSET_ELEM_PERMANENT ||
48-
time_after(timeout, jiffies));
48+
time_is_after_jiffies(timeout));
4949
}
5050

5151
static inline bool
5252
ip_set_timeout_expired(unsigned long timeout)
5353
{
5454
return timeout != IPSET_ELEM_UNSET &&
5555
timeout != IPSET_ELEM_PERMANENT &&
56-
time_before(timeout, jiffies);
56+
time_is_before_jiffies(timeout);
5757
}
5858

5959
static inline unsigned long
@@ -64,7 +64,7 @@ ip_set_timeout_set(u32 timeout)
6464
if (!timeout)
6565
return IPSET_ELEM_PERMANENT;
6666

67-
t = timeout * HZ + jiffies;
67+
t = msecs_to_jiffies(timeout * 1000) + jiffies;
6868
if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT)
6969
/* Bingo! */
7070
t++;
@@ -75,7 +75,8 @@ ip_set_timeout_set(u32 timeout)
7575
static inline u32
7676
ip_set_timeout_get(unsigned long timeout)
7777
{
78-
return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ;
78+
return timeout == IPSET_ELEM_PERMANENT ? 0 :
79+
jiffies_to_msecs(timeout - jiffies)/1000;
7980
}
8081

8182
#else
@@ -89,14 +90,14 @@ static inline bool
8990
ip_set_timeout_test(unsigned long timeout)
9091
{
9192
return timeout == IPSET_ELEM_PERMANENT ||
92-
time_after(timeout, jiffies);
93+
time_is_after_jiffies(timeout);
9394
}
9495

9596
static inline bool
9697
ip_set_timeout_expired(unsigned long timeout)
9798
{
9899
return timeout != IPSET_ELEM_PERMANENT &&
99-
time_before(timeout, jiffies);
100+
time_is_before_jiffies(timeout);
100101
}
101102

102103
static inline unsigned long
@@ -107,7 +108,7 @@ ip_set_timeout_set(u32 timeout)
107108
if (!timeout)
108109
return IPSET_ELEM_PERMANENT;
109110

110-
t = timeout * HZ + jiffies;
111+
t = msecs_to_jiffies(timeout * 1000) + jiffies;
111112
if (t == IPSET_ELEM_PERMANENT)
112113
/* Bingo! :-) */
113114
t++;
@@ -118,7 +119,8 @@ ip_set_timeout_set(u32 timeout)
118119
static inline u32
119120
ip_set_timeout_get(unsigned long timeout)
120121
{
121-
return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ;
122+
return timeout == IPSET_ELEM_PERMANENT ? 0 :
123+
jiffies_to_msecs(timeout - jiffies)/1000;
122124
}
123125
#endif /* ! IP_SET_BITMAP_TIMEOUT */
124126

include/net/ip_vs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,8 @@ struct netns_ipvs {
797797
struct list_head rs_table[IP_VS_RTAB_SIZE];
798798
/* ip_vs_app */
799799
struct list_head app_list;
800-
800+
/* ip_vs_ftp */
801+
struct ip_vs_app *ftp_app;
801802
/* ip_vs_proto */
802803
#define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
803804
struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE];

net/bridge/netfilter/ebtables.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,14 +1883,13 @@ static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt,
18831883
struct xt_target *wt;
18841884
void *dst = NULL;
18851885
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;
18871887

18881888
strlcpy(name, mwt->u.name, sizeof(name));
18891889

18901890
if (state->buf_kern_start)
18911891
dst = state->buf_kern_start + state->buf_kern_offset;
18921892

1893-
entry_offset = (unsigned char *) mwt - base;
18941893
switch (compat_mwt) {
18951894
case EBT_COMPAT_MATCH:
18961895
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,
19331932
size_kern = wt->targetsize;
19341933
module_put(wt->me);
19351934
break;
1935+
1936+
default:
1937+
return -EINVAL;
19361938
}
19371939

19381940
state->buf_kern_offset += match_size + off;

net/netfilter/ipset/ip_set_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ ip_set_flush(struct sock *ctnl, struct sk_buff *skb,
815815
ip_set_id_t i;
816816

817817
if (unlikely(protocol_failed(attr)))
818-
return -EPROTO;
818+
return -IPSET_ERR_PROTOCOL;
819819

820820
if (!attr[IPSET_ATTR_SETNAME]) {
821821
for (i = 0; i < ip_set_max; i++)

net/netfilter/ipvs/ip_vs_ftp.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -411,35 +411,46 @@ static struct ip_vs_app ip_vs_ftp = {
411411
static int __net_init __ip_vs_ftp_init(struct net *net)
412412
{
413413
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;
415423

416424
ret = register_ip_vs_app(net, app);
417425
if (ret)
418-
return ret;
426+
goto err_exit;
419427

420428
for (i=0; i<IP_VS_APP_MAX_PORTS; i++) {
421429
if (!ports[i])
422430
continue;
423431
ret = register_ip_vs_app_inc(net, app, app->protocol, ports[i]);
424432
if (ret)
425-
break;
433+
goto err_unreg;
426434
pr_info("%s: loaded support on port[%d] = %d\n",
427435
app->name, i, ports[i]);
428436
}
437+
return 0;
429438

430-
if (ret)
431-
unregister_ip_vs_app(net, app);
432-
439+
err_unreg:
440+
unregister_ip_vs_app(net, app);
441+
err_exit:
442+
kfree(ipvs->ftp_app);
433443
return ret;
434444
}
435445
/*
436446
* netns exit
437447
*/
438448
static void __ip_vs_ftp_exit(struct net *net)
439449
{
440-
struct ip_vs_app *app = &ip_vs_ftp;
450+
struct netns_ipvs *ipvs = net_ipvs(net);
441451

442-
unregister_ip_vs_app(net, app);
452+
unregister_ip_vs_app(net, ipvs->ftp_app);
453+
kfree(ipvs->ftp_app);
443454
}
444455

445456
static struct pernet_operations ip_vs_ftp_ops = {

0 commit comments

Comments
 (0)