@@ -803,6 +803,128 @@ struct ip_vs_app {
803803 void (* timeout_change )(struct ip_vs_app * app , int flags );
804804};
805805
806+ /* IPVS in network namespace */
807+ struct netns_ipvs {
808+ int gen ; /* Generation */
809+ /*
810+ * Hash table: for real service lookups
811+ */
812+ #define IP_VS_RTAB_BITS 4
813+ #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS)
814+ #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1)
815+
816+ struct list_head rs_table [IP_VS_RTAB_SIZE ];
817+ /* ip_vs_app */
818+ struct list_head app_list ;
819+ struct mutex app_mutex ;
820+ struct lock_class_key app_key ; /* mutex debuging */
821+
822+ /* ip_vs_proto */
823+ #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
824+ struct ip_vs_proto_data * proto_data_table [IP_VS_PROTO_TAB_SIZE ];
825+ /* ip_vs_proto_tcp */
826+ #ifdef CONFIG_IP_VS_PROTO_TCP
827+ #define TCP_APP_TAB_BITS 4
828+ #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS)
829+ #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1)
830+ struct list_head tcp_apps [TCP_APP_TAB_SIZE ];
831+ spinlock_t tcp_app_lock ;
832+ #endif
833+ /* ip_vs_proto_udp */
834+ #ifdef CONFIG_IP_VS_PROTO_UDP
835+ #define UDP_APP_TAB_BITS 4
836+ #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS)
837+ #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1)
838+ struct list_head udp_apps [UDP_APP_TAB_SIZE ];
839+ spinlock_t udp_app_lock ;
840+ #endif
841+ /* ip_vs_proto_sctp */
842+ #ifdef CONFIG_IP_VS_PROTO_SCTP
843+ #define SCTP_APP_TAB_BITS 4
844+ #define SCTP_APP_TAB_SIZE (1 << SCTP_APP_TAB_BITS)
845+ #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1)
846+ /* Hash table for SCTP application incarnations */
847+ struct list_head sctp_apps [SCTP_APP_TAB_SIZE ];
848+ spinlock_t sctp_app_lock ;
849+ #endif
850+ /* ip_vs_conn */
851+ atomic_t conn_count ; /* connection counter */
852+
853+ /* ip_vs_ctl */
854+ struct ip_vs_stats * tot_stats ; /* Statistics & est. */
855+ struct ip_vs_cpu_stats __percpu * cpustats ; /* Stats per cpu */
856+ seqcount_t * ustats_seq ; /* u64 read retry */
857+
858+ int num_services ; /* no of virtual services */
859+ /* 1/rate drop and drop-entry variables */
860+ struct delayed_work defense_work ; /* Work handler */
861+ int drop_rate ;
862+ int drop_counter ;
863+ atomic_t dropentry ;
864+ /* locks in ctl.c */
865+ spinlock_t dropentry_lock ; /* drop entry handling */
866+ spinlock_t droppacket_lock ; /* drop packet handling */
867+ spinlock_t securetcp_lock ; /* state and timeout tables */
868+ rwlock_t rs_lock ; /* real services table */
869+ /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */
870+ struct lock_class_key ctl_key ; /* ctl_mutex debuging */
871+ /* Trash for destinations */
872+ struct list_head dest_trash ;
873+ /* Service counters */
874+ atomic_t ftpsvc_counter ;
875+ atomic_t nullsvc_counter ;
876+
877+ /* sys-ctl struct */
878+ struct ctl_table_header * sysctl_hdr ;
879+ struct ctl_table * sysctl_tbl ;
880+ /* sysctl variables */
881+ int sysctl_amemthresh ;
882+ int sysctl_am_droprate ;
883+ int sysctl_drop_entry ;
884+ int sysctl_drop_packet ;
885+ int sysctl_secure_tcp ;
886+ #ifdef CONFIG_IP_VS_NFCT
887+ int sysctl_conntrack ;
888+ #endif
889+ int sysctl_snat_reroute ;
890+ int sysctl_sync_ver ;
891+ int sysctl_cache_bypass ;
892+ int sysctl_expire_nodest_conn ;
893+ int sysctl_expire_quiescent_template ;
894+ int sysctl_sync_threshold [2 ];
895+ int sysctl_nat_icmp_send ;
896+
897+ /* ip_vs_lblc */
898+ int sysctl_lblc_expiration ;
899+ struct ctl_table_header * lblc_ctl_header ;
900+ struct ctl_table * lblc_ctl_table ;
901+ /* ip_vs_lblcr */
902+ int sysctl_lblcr_expiration ;
903+ struct ctl_table_header * lblcr_ctl_header ;
904+ struct ctl_table * lblcr_ctl_table ;
905+ /* ip_vs_est */
906+ struct list_head est_list ; /* estimator list */
907+ spinlock_t est_lock ;
908+ struct timer_list est_timer ; /* Estimation timer */
909+ /* ip_vs_sync */
910+ struct list_head sync_queue ;
911+ spinlock_t sync_lock ;
912+ struct ip_vs_sync_buff * sync_buff ;
913+ spinlock_t sync_buff_lock ;
914+ struct sockaddr_in sync_mcast_addr ;
915+ struct task_struct * master_thread ;
916+ struct task_struct * backup_thread ;
917+ int send_mesg_maxlen ;
918+ int recv_mesg_maxlen ;
919+ volatile int sync_state ;
920+ volatile int master_syncid ;
921+ volatile int backup_syncid ;
922+ /* multicast interface name */
923+ char master_mcast_ifn [IP_VS_IFNAME_MAXLEN ];
924+ char backup_mcast_ifn [IP_VS_IFNAME_MAXLEN ];
925+ /* net name space ptr */
926+ struct net * net ; /* Needed by timer routines */
927+ };
806928
807929/*
808930 * IPVS core functions
0 commit comments