Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 299957
b: refs/heads/master
c: 582b8e3
h: refs/heads/master
i:
  299955: 1ead0d5
v: v3
  • Loading branch information
Hans Schillstrom authored and Pablo Neira Ayuso committed Apr 30, 2012
1 parent a213393 commit bdceb61
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4b984cd50bc1b6d492175cd77bfabb78e76ffa67
refs/heads/master: 582b8e3eadaec77788c1aa188081a8d5059c42a6
2 changes: 1 addition & 1 deletion trunk/include/net/ip_vs.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ struct ip_vs_protocol {

void (*exit)(struct ip_vs_protocol *pp);

void (*init_netns)(struct net *net, struct ip_vs_proto_data *pd);
int (*init_netns)(struct net *net, struct ip_vs_proto_data *pd);

void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd);

Expand Down
11 changes: 9 additions & 2 deletions trunk/net/netfilter/ipvs/ip_vs_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,15 @@ register_ip_vs_proto_netns(struct net *net, struct ip_vs_protocol *pp)
ipvs->proto_data_table[hash] = pd;
atomic_set(&pd->appcnt, 0); /* Init app counter */

if (pp->init_netns != NULL)
pp->init_netns(net, pd);
if (pp->init_netns != NULL) {
int ret = pp->init_netns(net, pd);
if (ret) {
/* unlink an free proto data */
ipvs->proto_data_table[hash] = pd->next;
kfree(pd);
return ret;
}
}

return 0;
}
Expand Down
5 changes: 4 additions & 1 deletion trunk/net/netfilter/ipvs/ip_vs_proto_sctp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1090,14 +1090,17 @@ static int sctp_app_conn_bind(struct ip_vs_conn *cp)
* timeouts is netns related now.
* ---------------------------------------------
*/
static void __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd)
static int __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd)
{
struct netns_ipvs *ipvs = net_ipvs(net);

ip_vs_init_hash_table(ipvs->sctp_apps, SCTP_APP_TAB_SIZE);
spin_lock_init(&ipvs->sctp_app_lock);
pd->timeout_table = ip_vs_create_timeout_table((int *)sctp_timeouts,
sizeof(sctp_timeouts));
if (!pd->timeout_table)
return -ENOMEM;
return 0;
}

static void __ip_vs_sctp_exit(struct net *net, struct ip_vs_proto_data *pd)
Expand Down
5 changes: 4 additions & 1 deletion trunk/net/netfilter/ipvs/ip_vs_proto_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,15 +677,18 @@ void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp)
* timeouts is netns related now.
* ---------------------------------------------
*/
static void __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd)
static int __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd)
{
struct netns_ipvs *ipvs = net_ipvs(net);

ip_vs_init_hash_table(ipvs->tcp_apps, TCP_APP_TAB_SIZE);
spin_lock_init(&ipvs->tcp_app_lock);
pd->timeout_table = ip_vs_create_timeout_table((int *)tcp_timeouts,
sizeof(tcp_timeouts));
if (!pd->timeout_table)
return -ENOMEM;
pd->tcp_state_table = tcp_states;
return 0;
}

static void __ip_vs_tcp_exit(struct net *net, struct ip_vs_proto_data *pd)
Expand Down
5 changes: 4 additions & 1 deletion trunk/net/netfilter/ipvs/ip_vs_proto_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,14 +467,17 @@ udp_state_transition(struct ip_vs_conn *cp, int direction,
cp->timeout = pd->timeout_table[IP_VS_UDP_S_NORMAL];
}

static void __udp_init(struct net *net, struct ip_vs_proto_data *pd)
static int __udp_init(struct net *net, struct ip_vs_proto_data *pd)
{
struct netns_ipvs *ipvs = net_ipvs(net);

ip_vs_init_hash_table(ipvs->udp_apps, UDP_APP_TAB_SIZE);
spin_lock_init(&ipvs->udp_app_lock);
pd->timeout_table = ip_vs_create_timeout_table((int *)udp_timeouts,
sizeof(udp_timeouts));
if (!pd->timeout_table)
return -ENOMEM;
return 0;
}

static void __udp_exit(struct net *net, struct ip_vs_proto_data *pd)
Expand Down

0 comments on commit bdceb61

Please sign in to comment.