Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipvs: address family of LBLCR entry depends on svc family

The LBLCR entries should use svc->af, not dest->af.
Needed to support svc->af != dest->af.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Alex Gartrell <agartrell@fb.com>
Signed-off-by: Simon Horman <horms@verge.net.au>

authored by

Julian Anastasov and committed by
Simon Horman
cf34e646 f7fa3800

+6 -6
+6 -6
net/netfilter/ipvs/ip_vs_lblcr.c
··· 362 362 */ 363 363 static inline struct ip_vs_lblcr_entry * 364 364 ip_vs_lblcr_new(struct ip_vs_lblcr_table *tbl, const union nf_inet_addr *daddr, 365 - struct ip_vs_dest *dest) 365 + u16 af, struct ip_vs_dest *dest) 366 366 { 367 367 struct ip_vs_lblcr_entry *en; 368 368 369 - en = ip_vs_lblcr_get(dest->af, tbl, daddr); 369 + en = ip_vs_lblcr_get(af, tbl, daddr); 370 370 if (!en) { 371 371 en = kmalloc(sizeof(*en), GFP_ATOMIC); 372 372 if (!en) 373 373 return NULL; 374 374 375 - en->af = dest->af; 376 - ip_vs_addr_copy(dest->af, &en->addr, daddr); 375 + en->af = af; 376 + ip_vs_addr_copy(af, &en->addr, daddr); 377 377 en->lastuse = jiffies; 378 378 379 379 /* initialize its dest set */ ··· 706 706 /* If we fail to create a cache entry, we'll just use the valid dest */ 707 707 spin_lock_bh(&svc->sched_lock); 708 708 if (!tbl->dead) 709 - ip_vs_lblcr_new(tbl, &iph->daddr, dest); 709 + ip_vs_lblcr_new(tbl, &iph->daddr, svc->af, dest); 710 710 spin_unlock_bh(&svc->sched_lock); 711 711 712 712 out: 713 713 IP_VS_DBG_BUF(6, "LBLCR: destination IP address %s --> server %s:%d\n", 714 714 IP_VS_DBG_ADDR(svc->af, &iph->daddr), 715 - IP_VS_DBG_ADDR(svc->af, &dest->addr), ntohs(dest->port)); 715 + IP_VS_DBG_ADDR(dest->af, &dest->addr), ntohs(dest->port)); 716 716 717 717 return dest; 718 718 }