aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/net/ip_vs.h53
-rw-r--r--include/net/netns/ip_vs.h2
2 files changed, 44 insertions, 11 deletions
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 605d5db81a39..f82c0ffdee74 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -477,6 +477,7 @@ extern struct ip_vs_proto_data *ip_vs_proto_data_get(struct net *net,
477 unsigned short proto); 477 unsigned short proto);
478 478
479struct ip_vs_conn_param { 479struct ip_vs_conn_param {
480 struct net *net;
480 const union nf_inet_addr *caddr; 481 const union nf_inet_addr *caddr;
481 const union nf_inet_addr *vaddr; 482 const union nf_inet_addr *vaddr;
482 __be16 cport; 483 __be16 cport;
@@ -494,17 +495,19 @@ struct ip_vs_conn_param {
494 */ 495 */
495struct ip_vs_conn { 496struct ip_vs_conn {
496 struct list_head c_list; /* hashed list heads */ 497 struct list_head c_list; /* hashed list heads */
497 498#ifdef CONFIG_NET_NS
499 struct net *net; /* Name space */
500#endif
498 /* Protocol, addresses and port numbers */ 501 /* Protocol, addresses and port numbers */
499 u16 af; /* address family */ 502 u16 af; /* address family */
500 union nf_inet_addr caddr; /* client address */ 503 __be16 cport;
501 union nf_inet_addr vaddr; /* virtual address */ 504 __be16 vport;
502 union nf_inet_addr daddr; /* destination address */ 505 __be16 dport;
503 volatile __u32 flags; /* status flags */ 506 __u32 fwmark; /* Fire wall mark from skb */
504 __u32 fwmark; /* Fire wall mark from skb */ 507 union nf_inet_addr caddr; /* client address */
505 __be16 cport; 508 union nf_inet_addr vaddr; /* virtual address */
506 __be16 vport; 509 union nf_inet_addr daddr; /* destination address */
507 __be16 dport; 510 volatile __u32 flags; /* status flags */
508 __u16 protocol; /* Which protocol (TCP/UDP) */ 511 __u16 protocol; /* Which protocol (TCP/UDP) */
509 512
510 /* counter and timer */ 513 /* counter and timer */
@@ -547,6 +550,33 @@ struct ip_vs_conn {
547 __u8 pe_data_len; 550 __u8 pe_data_len;
548}; 551};
549 552
553/*
554 * To save some memory in conn table when name space is disabled.
555 */
556static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp)
557{
558#ifdef CONFIG_NET_NS
559 return cp->net;
560#else
561 return &init_net;
562#endif
563}
564static inline void ip_vs_conn_net_set(struct ip_vs_conn *cp, struct net *net)
565{
566#ifdef CONFIG_NET_NS
567 cp->net = net;
568#endif
569}
570
571static inline int ip_vs_conn_net_eq(const struct ip_vs_conn *cp,
572 struct net *net)
573{
574#ifdef CONFIG_NET_NS
575 return cp->net == net;
576#else
577 return 1;
578#endif
579}
550 580
551/* 581/*
552 * Extended internal versions of struct ip_vs_service_user and 582 * Extended internal versions of struct ip_vs_service_user and
@@ -796,13 +826,14 @@ enum {
796 IP_VS_DIR_LAST, 826 IP_VS_DIR_LAST,
797}; 827};
798 828
799static inline void ip_vs_conn_fill_param(int af, int protocol, 829static inline void ip_vs_conn_fill_param(struct net *net, int af, int protocol,
800 const union nf_inet_addr *caddr, 830 const union nf_inet_addr *caddr,
801 __be16 cport, 831 __be16 cport,
802 const union nf_inet_addr *vaddr, 832 const union nf_inet_addr *vaddr,
803 __be16 vport, 833 __be16 vport,
804 struct ip_vs_conn_param *p) 834 struct ip_vs_conn_param *p)
805{ 835{
836 p->net = net;
806 p->af = af; 837 p->af = af;
807 p->protocol = protocol; 838 p->protocol = protocol;
808 p->caddr = caddr; 839 p->caddr = caddr;
diff --git a/include/net/netns/ip_vs.h b/include/net/netns/ip_vs.h
index bd1dad872178..1acfb334e69b 100644
--- a/include/net/netns/ip_vs.h
+++ b/include/net/netns/ip_vs.h
@@ -66,6 +66,8 @@ struct netns_ipvs {
66 struct ip_vs_cpu_stats __percpu *cpustats; /* Stats per cpu */ 66 struct ip_vs_cpu_stats __percpu *cpustats; /* Stats per cpu */
67 seqcount_t *ustats_seq; /* u64 read retry */ 67 seqcount_t *ustats_seq; /* u64 read retry */
68 68
69 /* ip_vs_conn */
70 atomic_t conn_count; /* connection counter */
69 /* ip_vs_lblc */ 71 /* ip_vs_lblc */
70 int sysctl_lblc_expiration; 72 int sysctl_lblc_expiration;
71 struct ctl_table_header *lblc_ctl_header; 73 struct ctl_table_header *lblc_ctl_header;