aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2010-08-22 08:37:54 -0400
committerSimon Horman <horms@verge.net.au>2010-10-04 09:45:24 -0400
commitf71499aa11f884255b69ce6c3b3c398c821591a1 (patch)
tree85d70bcbbe1312c5853db0ceadf348bbf40fbe33 /net
parent0d1e71b04a04b6912e50926b9987c1e72facb1f3 (diff)
IPVS: Fallback if persistence engine fails
Fall back to normal persistence handling if the persistence engine fails to recognise a packet. This way, at least the packet will go somewhere. It is envisaged that iptables could be used to block packets such if this is not desired although nf_conntrack_sip would likely need to be enhanced first. Signed-off-by: Simon Horman <horms@verge.net.au> Acked-by: Julian Anastasov <ja@ssi.bg>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/ipvs/ip_vs_conn.c6
-rw-r--r--net/netfilter/ipvs/ip_vs_core.c10
2 files changed, 7 insertions, 9 deletions
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index 4adedefdf563..1d1a529dbe24 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -154,7 +154,7 @@ static unsigned int ip_vs_conn_hashkey_param(const struct ip_vs_conn_param *p,
154 const union nf_inet_addr *addr; 154 const union nf_inet_addr *addr;
155 __be16 port; 155 __be16 port;
156 156
157 if (p->pe && p->pe->hashkey_raw) 157 if (p->pe_data && p->pe->hashkey_raw)
158 return p->pe->hashkey_raw(p, ip_vs_conn_rnd, inverse) & 158 return p->pe->hashkey_raw(p, ip_vs_conn_rnd, inverse) &
159 ip_vs_conn_tab_mask; 159 ip_vs_conn_tab_mask;
160 160
@@ -353,7 +353,7 @@ struct ip_vs_conn *ip_vs_ct_in_get(const struct ip_vs_conn_param *p)
353 ct_read_lock(hash); 353 ct_read_lock(hash);
354 354
355 list_for_each_entry(cp, &ip_vs_conn_tab[hash], c_list) { 355 list_for_each_entry(cp, &ip_vs_conn_tab[hash], c_list) {
356 if (p->pe && p->pe->ct_match) { 356 if (p->pe_data && p->pe->ct_match) {
357 if (p->pe->ct_match(p, cp)) 357 if (p->pe->ct_match(p, cp))
358 goto out; 358 goto out;
359 continue; 359 continue;
@@ -956,7 +956,7 @@ static int ip_vs_conn_seq_show(struct seq_file *seq, void *v)
956 char pe_data[IP_VS_PENAME_MAXLEN + IP_VS_PEDATA_MAXLEN + 3]; 956 char pe_data[IP_VS_PENAME_MAXLEN + IP_VS_PEDATA_MAXLEN + 3];
957 size_t len = 0; 957 size_t len = 0;
958 958
959 if (cp->dest && cp->dest->svc->pe && 959 if (cp->dest && cp->pe_data &&
960 cp->dest->svc->pe->show_pe_data) { 960 cp->dest->svc->pe->show_pe_data) {
961 pe_data[0] = ' '; 961 pe_data[0] = ' ';
962 len = strlen(cp->dest->svc->pe->name); 962 len = strlen(cp->dest->svc->pe->name);
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index ab9889380496..e5fef7aef0d4 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -176,7 +176,7 @@ ip_vs_set_state(struct ip_vs_conn *cp, int direction,
176 return pp->state_transition(cp, direction, skb, pp); 176 return pp->state_transition(cp, direction, skb, pp);
177} 177}
178 178
179static inline int 179static inline void
180ip_vs_conn_fill_param_persist(const struct ip_vs_service *svc, 180ip_vs_conn_fill_param_persist(const struct ip_vs_service *svc,
181 struct sk_buff *skb, int protocol, 181 struct sk_buff *skb, int protocol,
182 const union nf_inet_addr *caddr, __be16 cport, 182 const union nf_inet_addr *caddr, __be16 cport,
@@ -186,8 +186,7 @@ ip_vs_conn_fill_param_persist(const struct ip_vs_service *svc,
186 ip_vs_conn_fill_param(svc->af, protocol, caddr, cport, vaddr, vport, p); 186 ip_vs_conn_fill_param(svc->af, protocol, caddr, cport, vaddr, vport, p);
187 p->pe = svc->pe; 187 p->pe = svc->pe;
188 if (p->pe && p->pe->fill_param) 188 if (p->pe && p->pe->fill_param)
189 return p->pe->fill_param(p, skb); 189 p->pe->fill_param(p, skb);
190 return 0;
191} 190}
192 191
193/* 192/*
@@ -268,9 +267,8 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
268 vaddr = &fwmark; 267 vaddr = &fwmark;
269 } 268 }
270 } 269 }
271 if (ip_vs_conn_fill_param_persist(svc, skb, protocol, &snet, 0, 270 ip_vs_conn_fill_param_persist(svc, skb, protocol, &snet, 0,
272 vaddr, vport, &param)) 271 vaddr, vport, &param);
273 return NULL;
274 } 272 }
275 273
276 /* Check if a template already exists */ 274 /* Check if a template already exists */