Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 236576
b: refs/heads/master
c: e9e5eee
h: refs/heads/master
v: v3
  • Loading branch information
Simon Horman committed Nov 15, 2010
1 parent de4a56c commit 6512799
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 26 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: 3bfd45f93c8bca7a5dc955235ff083602d95aa43
refs/heads/master: e9e5eee8733739f13a204132b502494b3f494f3b
16 changes: 14 additions & 2 deletions trunk/include/net/ip_vs.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ struct ip_vs_conn {
struct ip_vs_seq in_seq; /* incoming seq. struct */
struct ip_vs_seq out_seq; /* outgoing seq. struct */

const struct ip_vs_pe *pe;
char *pe_data;
__u8 pe_data_len;
};
Expand Down Expand Up @@ -814,8 +815,19 @@ void ip_vs_bind_pe(struct ip_vs_service *svc, struct ip_vs_pe *pe);
void ip_vs_unbind_pe(struct ip_vs_service *svc);
int register_ip_vs_pe(struct ip_vs_pe *pe);
int unregister_ip_vs_pe(struct ip_vs_pe *pe);
extern struct ip_vs_pe *ip_vs_pe_get(const char *name);
extern void ip_vs_pe_put(struct ip_vs_pe *pe);
struct ip_vs_pe *ip_vs_pe_getbyname(const char *name);

static inline void ip_vs_pe_get(const struct ip_vs_pe *pe)
{
if (pe && pe->module)
__module_get(pe->module);
}

static inline void ip_vs_pe_put(const struct ip_vs_pe *pe)
{
if (pe && pe->module)
module_put(pe->module);
}

/*
* IPVS protocol functions (from ip_vs_proto.c)
Expand Down
19 changes: 10 additions & 9 deletions trunk/net/netfilter/ipvs/ip_vs_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ static unsigned int ip_vs_conn_hashkey_conn(const struct ip_vs_conn *cp)
ip_vs_conn_fill_param(cp->af, cp->protocol, &cp->caddr, cp->cport,
NULL, 0, &p);

if (cp->dest && cp->dest->svc->pe) {
p.pe = cp->dest->svc->pe;
if (cp->pe) {
p.pe = cp->pe;
p.pe_data = cp->pe_data;
p.pe_data_len = cp->pe_data_len;
}
Expand Down Expand Up @@ -765,6 +765,7 @@ static void ip_vs_conn_expire(unsigned long data)
if (cp->flags & IP_VS_CONN_F_NFCT)
ip_vs_conn_drop_conntrack(cp);

ip_vs_pe_put(cp->pe);
kfree(cp->pe_data);
if (unlikely(cp->app != NULL))
ip_vs_unbind_app(cp);
Expand Down Expand Up @@ -826,7 +827,9 @@ ip_vs_conn_new(const struct ip_vs_conn_param *p,
&cp->daddr, daddr);
cp->dport = dport;
cp->flags = flags;
if (flags & IP_VS_CONN_F_TEMPLATE && p->pe_data) {
if (flags & IP_VS_CONN_F_TEMPLATE && p->pe) {
ip_vs_pe_get(p->pe);
cp->pe = p->pe;
cp->pe_data = p->pe_data;
cp->pe_data_len = p->pe_data_len;
}
Expand Down Expand Up @@ -958,15 +961,13 @@ static int ip_vs_conn_seq_show(struct seq_file *seq, void *v)
char pe_data[IP_VS_PENAME_MAXLEN + IP_VS_PEDATA_MAXLEN + 3];
size_t len = 0;

if (cp->dest && cp->pe_data &&
cp->dest->svc->pe->show_pe_data) {
if (cp->pe_data) {
pe_data[0] = ' ';
len = strlen(cp->dest->svc->pe->name);
memcpy(pe_data + 1, cp->dest->svc->pe->name, len);
len = strlen(cp->pe->name);
memcpy(pe_data + 1, cp->pe->name, len);
pe_data[len + 1] = ' ';
len += 2;
len += cp->dest->svc->pe->show_pe_data(cp,
pe_data + len);
len += cp->pe->show_pe_data(cp, pe_data + len);
}
pe_data[len] = '\0';

Expand Down
4 changes: 2 additions & 2 deletions trunk/net/netfilter/ipvs/ip_vs_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ ip_vs_add_service(struct ip_vs_service_user_kern *u,
}

if (u->pe_name && *u->pe_name) {
pe = ip_vs_pe_get(u->pe_name);
pe = ip_vs_pe_getbyname(u->pe_name);
if (pe == NULL) {
pr_info("persistence engine module ip_vs_pe_%s "
"not found\n", u->pe_name);
Expand Down Expand Up @@ -1250,7 +1250,7 @@ ip_vs_edit_service(struct ip_vs_service *svc, struct ip_vs_service_user_kern *u)
old_sched = sched;

if (u->pe_name && *u->pe_name) {
pe = ip_vs_pe_get(u->pe_name);
pe = ip_vs_pe_getbyname(u->pe_name);
if (pe == NULL) {
pr_info("persistence engine module ip_vs_pe_%s "
"not found\n", u->pe_name);
Expand Down
14 changes: 4 additions & 10 deletions trunk/net/netfilter/ipvs/ip_vs_pe.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void ip_vs_unbind_pe(struct ip_vs_service *svc)

/* Get pe in the pe list by name */
static struct ip_vs_pe *
ip_vs_pe_getbyname(const char *pe_name)
__ip_vs_pe_getbyname(const char *pe_name)
{
struct ip_vs_pe *pe;

Expand Down Expand Up @@ -60,28 +60,22 @@ ip_vs_pe_getbyname(const char *pe_name)
}

/* Lookup pe and try to load it if it doesn't exist */
struct ip_vs_pe *ip_vs_pe_get(const char *name)
struct ip_vs_pe *ip_vs_pe_getbyname(const char *name)
{
struct ip_vs_pe *pe;

/* Search for the pe by name */
pe = ip_vs_pe_getbyname(name);
pe = __ip_vs_pe_getbyname(name);

/* If pe not found, load the module and search again */
if (!pe) {
request_module("ip_vs_pe_%s", name);
pe = ip_vs_pe_getbyname(name);
pe = __ip_vs_pe_getbyname(name);
}

return pe;
}

void ip_vs_pe_put(struct ip_vs_pe *pe)
{
if (pe && pe->module)
module_put(pe->module);
}

/* Register a pe in the pe list */
int register_ip_vs_pe(struct ip_vs_pe *pe)
{
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/netfilter/nf_conntrack_expect.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,7 @@ static void nf_ct_expect_insert(struct nf_conntrack_expect *exp)
const struct nf_conntrack_expect_policy *p;
unsigned int h = nf_ct_expect_dst_hash(&exp->tuple);

/* two references : one for hash insert, one for the timer */
atomic_add(2, &exp->use);
atomic_inc(&exp->use);

if (master_help) {
hlist_add_head(&exp->lnode, &master_help->expectations);
Expand All @@ -346,6 +345,7 @@ static void nf_ct_expect_insert(struct nf_conntrack_expect *exp)
}
add_timer(&exp->timeout);

atomic_inc(&exp->use);
NF_CT_STAT_INC(net, expect_create);
}

Expand Down

0 comments on commit 6512799

Please sign in to comment.