diff options
Diffstat (limited to 'include/net/ip_vs.h')
| -rw-r--r-- | include/net/ip_vs.h | 140 |
1 files changed, 93 insertions, 47 deletions
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index fce8e6b66d55..4c062ccff9aa 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
| @@ -233,6 +233,21 @@ static inline void ip_vs_addr_copy(int af, union nf_inet_addr *dst, | |||
| 233 | dst->ip = src->ip; | 233 | dst->ip = src->ip; |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | static inline void ip_vs_addr_set(int af, union nf_inet_addr *dst, | ||
| 237 | const union nf_inet_addr *src) | ||
| 238 | { | ||
| 239 | #ifdef CONFIG_IP_VS_IPV6 | ||
| 240 | if (af == AF_INET6) { | ||
| 241 | dst->in6 = src->in6; | ||
| 242 | return; | ||
| 243 | } | ||
| 244 | #endif | ||
| 245 | dst->ip = src->ip; | ||
| 246 | dst->all[1] = 0; | ||
| 247 | dst->all[2] = 0; | ||
| 248 | dst->all[3] = 0; | ||
| 249 | } | ||
| 250 | |||
| 236 | static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a, | 251 | static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a, |
| 237 | const union nf_inet_addr *b) | 252 | const union nf_inet_addr *b) |
| 238 | { | 253 | { |
| @@ -344,8 +359,6 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len, | |||
| 344 | #define LeaveFunction(level) do {} while (0) | 359 | #define LeaveFunction(level) do {} while (0) |
| 345 | #endif | 360 | #endif |
| 346 | 361 | ||
| 347 | #define IP_VS_WAIT_WHILE(expr) while (expr) { cpu_relax(); } | ||
| 348 | |||
| 349 | 362 | ||
| 350 | /* | 363 | /* |
| 351 | * The port number of FTP service (in network order). | 364 | * The port number of FTP service (in network order). |
| @@ -459,7 +472,7 @@ struct ip_vs_estimator { | |||
| 459 | struct ip_vs_stats { | 472 | struct ip_vs_stats { |
| 460 | struct ip_vs_stats_user ustats; /* statistics */ | 473 | struct ip_vs_stats_user ustats; /* statistics */ |
| 461 | struct ip_vs_estimator est; /* estimator */ | 474 | struct ip_vs_estimator est; /* estimator */ |
| 462 | struct ip_vs_cpu_stats *cpustats; /* per cpu counters */ | 475 | struct ip_vs_cpu_stats __percpu *cpustats; /* per cpu counters */ |
| 463 | spinlock_t lock; /* spin lock */ | 476 | spinlock_t lock; /* spin lock */ |
| 464 | struct ip_vs_stats_user ustats0; /* reset values */ | 477 | struct ip_vs_stats_user ustats0; /* reset values */ |
| 465 | }; | 478 | }; |
| @@ -566,20 +579,19 @@ struct ip_vs_conn_param { | |||
| 566 | */ | 579 | */ |
| 567 | struct ip_vs_conn { | 580 | struct ip_vs_conn { |
| 568 | struct hlist_node c_list; /* hashed list heads */ | 581 | struct hlist_node c_list; /* hashed list heads */ |
| 569 | #ifdef CONFIG_NET_NS | ||
| 570 | struct net *net; /* Name space */ | ||
| 571 | #endif | ||
| 572 | /* Protocol, addresses and port numbers */ | 582 | /* Protocol, addresses and port numbers */ |
| 573 | u16 af; /* address family */ | ||
| 574 | __be16 cport; | 583 | __be16 cport; |
| 575 | __be16 vport; | ||
| 576 | __be16 dport; | 584 | __be16 dport; |
| 577 | __u32 fwmark; /* Fire wall mark from skb */ | 585 | __be16 vport; |
| 586 | u16 af; /* address family */ | ||
| 578 | union nf_inet_addr caddr; /* client address */ | 587 | union nf_inet_addr caddr; /* client address */ |
| 579 | union nf_inet_addr vaddr; /* virtual address */ | 588 | union nf_inet_addr vaddr; /* virtual address */ |
| 580 | union nf_inet_addr daddr; /* destination address */ | 589 | union nf_inet_addr daddr; /* destination address */ |
| 581 | volatile __u32 flags; /* status flags */ | 590 | volatile __u32 flags; /* status flags */ |
| 582 | __u16 protocol; /* Which protocol (TCP/UDP) */ | 591 | __u16 protocol; /* Which protocol (TCP/UDP) */ |
| 592 | #ifdef CONFIG_NET_NS | ||
| 593 | struct net *net; /* Name space */ | ||
| 594 | #endif | ||
| 583 | 595 | ||
| 584 | /* counter and timer */ | 596 | /* counter and timer */ |
| 585 | atomic_t refcnt; /* reference count */ | 597 | atomic_t refcnt; /* reference count */ |
| @@ -593,6 +605,7 @@ struct ip_vs_conn { | |||
| 593 | * state transition triggerd | 605 | * state transition triggerd |
| 594 | * synchronization | 606 | * synchronization |
| 595 | */ | 607 | */ |
| 608 | __u32 fwmark; /* Fire wall mark from skb */ | ||
| 596 | unsigned long sync_endtime; /* jiffies + sent_retries */ | 609 | unsigned long sync_endtime; /* jiffies + sent_retries */ |
| 597 | 610 | ||
| 598 | /* Control members */ | 611 | /* Control members */ |
| @@ -620,6 +633,8 @@ struct ip_vs_conn { | |||
| 620 | const struct ip_vs_pe *pe; | 633 | const struct ip_vs_pe *pe; |
| 621 | char *pe_data; | 634 | char *pe_data; |
| 622 | __u8 pe_data_len; | 635 | __u8 pe_data_len; |
| 636 | |||
| 637 | struct rcu_head rcu_head; | ||
| 623 | }; | 638 | }; |
| 624 | 639 | ||
| 625 | /* | 640 | /* |
| @@ -663,7 +678,7 @@ struct ip_vs_service_user_kern { | |||
| 663 | u16 af; | 678 | u16 af; |
| 664 | u16 protocol; | 679 | u16 protocol; |
| 665 | union nf_inet_addr addr; /* virtual ip address */ | 680 | union nf_inet_addr addr; /* virtual ip address */ |
| 666 | u16 port; | 681 | __be16 port; |
| 667 | u32 fwmark; /* firwall mark of service */ | 682 | u32 fwmark; /* firwall mark of service */ |
| 668 | 683 | ||
| 669 | /* virtual service options */ | 684 | /* virtual service options */ |
| @@ -671,14 +686,14 @@ struct ip_vs_service_user_kern { | |||
| 671 | char *pe_name; | 686 | char *pe_name; |
| 672 | unsigned int flags; /* virtual service flags */ | 687 | unsigned int flags; /* virtual service flags */ |
| 673 | unsigned int timeout; /* persistent timeout in sec */ | 688 | unsigned int timeout; /* persistent timeout in sec */ |
| 674 | u32 netmask; /* persistent netmask */ | 689 | __be32 netmask; /* persistent netmask or plen */ |
| 675 | }; | 690 | }; |
| 676 | 691 | ||
| 677 | 692 | ||
| 678 | struct ip_vs_dest_user_kern { | 693 | struct ip_vs_dest_user_kern { |
| 679 | /* destination server address */ | 694 | /* destination server address */ |
| 680 | union nf_inet_addr addr; | 695 | union nf_inet_addr addr; |
| 681 | u16 port; | 696 | __be16 port; |
| 682 | 697 | ||
| 683 | /* real server options */ | 698 | /* real server options */ |
| 684 | unsigned int conn_flags; /* connection flags */ | 699 | unsigned int conn_flags; /* connection flags */ |
| @@ -695,10 +710,9 @@ struct ip_vs_dest_user_kern { | |||
| 695 | * and the forwarding entries | 710 | * and the forwarding entries |
| 696 | */ | 711 | */ |
| 697 | struct ip_vs_service { | 712 | struct ip_vs_service { |
| 698 | struct list_head s_list; /* for normal service table */ | 713 | struct hlist_node s_list; /* for normal service table */ |
| 699 | struct list_head f_list; /* for fwmark-based service table */ | 714 | struct hlist_node f_list; /* for fwmark-based service table */ |
| 700 | atomic_t refcnt; /* reference counter */ | 715 | atomic_t refcnt; /* reference counter */ |
| 701 | atomic_t usecnt; /* use counter */ | ||
| 702 | 716 | ||
| 703 | u16 af; /* address family */ | 717 | u16 af; /* address family */ |
| 704 | __u16 protocol; /* which protocol (TCP/UDP) */ | 718 | __u16 protocol; /* which protocol (TCP/UDP) */ |
| @@ -707,31 +721,41 @@ struct ip_vs_service { | |||
| 707 | __u32 fwmark; /* firewall mark of the service */ | 721 | __u32 fwmark; /* firewall mark of the service */ |
| 708 | unsigned int flags; /* service status flags */ | 722 | unsigned int flags; /* service status flags */ |
| 709 | unsigned int timeout; /* persistent timeout in ticks */ | 723 | unsigned int timeout; /* persistent timeout in ticks */ |
| 710 | __be32 netmask; /* grouping granularity */ | 724 | __be32 netmask; /* grouping granularity, mask/plen */ |
| 711 | struct net *net; | 725 | struct net *net; |
| 712 | 726 | ||
| 713 | struct list_head destinations; /* real server d-linked list */ | 727 | struct list_head destinations; /* real server d-linked list */ |
| 714 | __u32 num_dests; /* number of servers */ | 728 | __u32 num_dests; /* number of servers */ |
| 715 | struct ip_vs_stats stats; /* statistics for the service */ | 729 | struct ip_vs_stats stats; /* statistics for the service */ |
| 716 | struct ip_vs_app *inc; /* bind conns to this app inc */ | ||
| 717 | 730 | ||
| 718 | /* for scheduling */ | 731 | /* for scheduling */ |
| 719 | struct ip_vs_scheduler *scheduler; /* bound scheduler object */ | 732 | struct ip_vs_scheduler __rcu *scheduler; /* bound scheduler object */ |
| 720 | rwlock_t sched_lock; /* lock sched_data */ | 733 | spinlock_t sched_lock; /* lock sched_data */ |
| 721 | void *sched_data; /* scheduler application data */ | 734 | void *sched_data; /* scheduler application data */ |
| 722 | 735 | ||
| 723 | /* alternate persistence engine */ | 736 | /* alternate persistence engine */ |
| 724 | struct ip_vs_pe *pe; | 737 | struct ip_vs_pe __rcu *pe; |
| 738 | |||
| 739 | struct rcu_head rcu_head; | ||
| 725 | }; | 740 | }; |
| 726 | 741 | ||
| 742 | /* Information for cached dst */ | ||
| 743 | struct ip_vs_dest_dst { | ||
| 744 | struct dst_entry *dst_cache; /* destination cache entry */ | ||
| 745 | u32 dst_cookie; | ||
| 746 | union nf_inet_addr dst_saddr; | ||
| 747 | struct rcu_head rcu_head; | ||
| 748 | }; | ||
| 727 | 749 | ||
| 750 | /* In grace period after removing */ | ||
| 751 | #define IP_VS_DEST_STATE_REMOVING 0x01 | ||
| 728 | /* | 752 | /* |
| 729 | * The real server destination forwarding entry | 753 | * The real server destination forwarding entry |
| 730 | * with ip address, port number, and so on. | 754 | * with ip address, port number, and so on. |
| 731 | */ | 755 | */ |
| 732 | struct ip_vs_dest { | 756 | struct ip_vs_dest { |
| 733 | struct list_head n_list; /* for the dests in the service */ | 757 | struct list_head n_list; /* for the dests in the service */ |
| 734 | struct list_head d_list; /* for table with all the dests */ | 758 | struct hlist_node d_list; /* for table with all the dests */ |
| 735 | 759 | ||
| 736 | u16 af; /* address family */ | 760 | u16 af; /* address family */ |
| 737 | __be16 port; /* port number of the server */ | 761 | __be16 port; /* port number of the server */ |
| @@ -742,6 +766,7 @@ struct ip_vs_dest { | |||
| 742 | 766 | ||
| 743 | atomic_t refcnt; /* reference counter */ | 767 | atomic_t refcnt; /* reference counter */ |
| 744 | struct ip_vs_stats stats; /* statistics */ | 768 | struct ip_vs_stats stats; /* statistics */ |
| 769 | unsigned long state; /* state flags */ | ||
| 745 | 770 | ||
| 746 | /* connection counters and thresholds */ | 771 | /* connection counters and thresholds */ |
| 747 | atomic_t activeconns; /* active connections */ | 772 | atomic_t activeconns; /* active connections */ |
| @@ -752,10 +777,7 @@ struct ip_vs_dest { | |||
| 752 | 777 | ||
| 753 | /* for destination cache */ | 778 | /* for destination cache */ |
| 754 | spinlock_t dst_lock; /* lock of dst_cache */ | 779 | spinlock_t dst_lock; /* lock of dst_cache */ |
| 755 | struct dst_entry *dst_cache; /* destination cache entry */ | 780 | struct ip_vs_dest_dst __rcu *dest_dst; /* cached dst info */ |
| 756 | u32 dst_rtos; /* RT_TOS(tos) for dst */ | ||
| 757 | u32 dst_cookie; | ||
| 758 | union nf_inet_addr dst_saddr; | ||
| 759 | 781 | ||
| 760 | /* for virtual service */ | 782 | /* for virtual service */ |
| 761 | struct ip_vs_service *svc; /* service it belongs to */ | 783 | struct ip_vs_service *svc; /* service it belongs to */ |
| @@ -763,6 +785,10 @@ struct ip_vs_dest { | |||
| 763 | __be16 vport; /* virtual port number */ | 785 | __be16 vport; /* virtual port number */ |
| 764 | union nf_inet_addr vaddr; /* virtual IP address */ | 786 | union nf_inet_addr vaddr; /* virtual IP address */ |
| 765 | __u32 vfwmark; /* firewall mark of service */ | 787 | __u32 vfwmark; /* firewall mark of service */ |
| 788 | |||
| 789 | struct list_head t_list; /* in dest_trash */ | ||
| 790 | struct rcu_head rcu_head; | ||
| 791 | unsigned int in_rs_table:1; /* we are in rs_table */ | ||
| 766 | }; | 792 | }; |
| 767 | 793 | ||
| 768 | 794 | ||
| @@ -778,9 +804,13 @@ struct ip_vs_scheduler { | |||
| 778 | /* scheduler initializing service */ | 804 | /* scheduler initializing service */ |
| 779 | int (*init_service)(struct ip_vs_service *svc); | 805 | int (*init_service)(struct ip_vs_service *svc); |
| 780 | /* scheduling service finish */ | 806 | /* scheduling service finish */ |
| 781 | int (*done_service)(struct ip_vs_service *svc); | 807 | void (*done_service)(struct ip_vs_service *svc); |
| 782 | /* scheduler updating service */ | 808 | /* dest is linked */ |
| 783 | int (*update_service)(struct ip_vs_service *svc); | 809 | int (*add_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest); |
| 810 | /* dest is unlinked */ | ||
| 811 | int (*del_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest); | ||
| 812 | /* dest is updated */ | ||
| 813 | int (*upd_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest); | ||
| 784 | 814 | ||
| 785 | /* selecting a server from the given service */ | 815 | /* selecting a server from the given service */ |
| 786 | struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc, | 816 | struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc, |
| @@ -819,6 +849,7 @@ struct ip_vs_app { | |||
| 819 | struct ip_vs_app *app; /* its real application */ | 849 | struct ip_vs_app *app; /* its real application */ |
| 820 | __be16 port; /* port number in net order */ | 850 | __be16 port; /* port number in net order */ |
| 821 | atomic_t usecnt; /* usage counter */ | 851 | atomic_t usecnt; /* usage counter */ |
| 852 | struct rcu_head rcu_head; | ||
| 822 | 853 | ||
| 823 | /* | 854 | /* |
| 824 | * output hook: Process packet in inout direction, diff set for TCP. | 855 | * output hook: Process packet in inout direction, diff set for TCP. |
| @@ -881,6 +912,9 @@ struct ipvs_master_sync_state { | |||
| 881 | struct netns_ipvs *ipvs; | 912 | struct netns_ipvs *ipvs; |
| 882 | }; | 913 | }; |
| 883 | 914 | ||
| 915 | /* How much time to keep dests in trash */ | ||
| 916 | #define IP_VS_DEST_TRASH_PERIOD (120 * HZ) | ||
| 917 | |||
| 884 | /* IPVS in network namespace */ | 918 | /* IPVS in network namespace */ |
| 885 | struct netns_ipvs { | 919 | struct netns_ipvs { |
| 886 | int gen; /* Generation */ | 920 | int gen; /* Generation */ |
| @@ -892,7 +926,7 @@ struct netns_ipvs { | |||
| 892 | #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS) | 926 | #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS) |
| 893 | #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1) | 927 | #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1) |
| 894 | 928 | ||
| 895 | struct list_head rs_table[IP_VS_RTAB_SIZE]; | 929 | struct hlist_head rs_table[IP_VS_RTAB_SIZE]; |
| 896 | /* ip_vs_app */ | 930 | /* ip_vs_app */ |
| 897 | struct list_head app_list; | 931 | struct list_head app_list; |
| 898 | /* ip_vs_proto */ | 932 | /* ip_vs_proto */ |
| @@ -904,7 +938,6 @@ struct netns_ipvs { | |||
| 904 | #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS) | 938 | #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS) |
| 905 | #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1) | 939 | #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1) |
| 906 | struct list_head tcp_apps[TCP_APP_TAB_SIZE]; | 940 | struct list_head tcp_apps[TCP_APP_TAB_SIZE]; |
| 907 | spinlock_t tcp_app_lock; | ||
| 908 | #endif | 941 | #endif |
| 909 | /* ip_vs_proto_udp */ | 942 | /* ip_vs_proto_udp */ |
| 910 | #ifdef CONFIG_IP_VS_PROTO_UDP | 943 | #ifdef CONFIG_IP_VS_PROTO_UDP |
| @@ -912,7 +945,6 @@ struct netns_ipvs { | |||
| 912 | #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS) | 945 | #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS) |
| 913 | #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1) | 946 | #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1) |
| 914 | struct list_head udp_apps[UDP_APP_TAB_SIZE]; | 947 | struct list_head udp_apps[UDP_APP_TAB_SIZE]; |
| 915 | spinlock_t udp_app_lock; | ||
| 916 | #endif | 948 | #endif |
| 917 | /* ip_vs_proto_sctp */ | 949 | /* ip_vs_proto_sctp */ |
| 918 | #ifdef CONFIG_IP_VS_PROTO_SCTP | 950 | #ifdef CONFIG_IP_VS_PROTO_SCTP |
| @@ -921,7 +953,6 @@ struct netns_ipvs { | |||
| 921 | #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1) | 953 | #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1) |
| 922 | /* Hash table for SCTP application incarnations */ | 954 | /* Hash table for SCTP application incarnations */ |
| 923 | struct list_head sctp_apps[SCTP_APP_TAB_SIZE]; | 955 | struct list_head sctp_apps[SCTP_APP_TAB_SIZE]; |
| 924 | spinlock_t sctp_app_lock; | ||
| 925 | #endif | 956 | #endif |
| 926 | /* ip_vs_conn */ | 957 | /* ip_vs_conn */ |
| 927 | atomic_t conn_count; /* connection counter */ | 958 | atomic_t conn_count; /* connection counter */ |
| @@ -931,9 +962,10 @@ struct netns_ipvs { | |||
| 931 | 962 | ||
| 932 | int num_services; /* no of virtual services */ | 963 | int num_services; /* no of virtual services */ |
| 933 | 964 | ||
| 934 | rwlock_t rs_lock; /* real services table */ | ||
| 935 | /* Trash for destinations */ | 965 | /* Trash for destinations */ |
| 936 | struct list_head dest_trash; | 966 | struct list_head dest_trash; |
| 967 | spinlock_t dest_trash_lock; | ||
| 968 | struct timer_list dest_trash_timer; /* expiration timer */ | ||
| 937 | /* Service counters */ | 969 | /* Service counters */ |
| 938 | atomic_t ftpsvc_counter; | 970 | atomic_t ftpsvc_counter; |
| 939 | atomic_t nullsvc_counter; | 971 | atomic_t nullsvc_counter; |
| @@ -1181,9 +1213,19 @@ struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb, | |||
| 1181 | const struct ip_vs_iphdr *iph, | 1213 | const struct ip_vs_iphdr *iph, |
| 1182 | int inverse); | 1214 | int inverse); |
| 1183 | 1215 | ||
| 1216 | /* Get reference to gain full access to conn. | ||
| 1217 | * By default, RCU read-side critical sections have access only to | ||
| 1218 | * conn fields and its PE data, see ip_vs_conn_rcu_free() for reference. | ||
| 1219 | */ | ||
| 1220 | static inline bool __ip_vs_conn_get(struct ip_vs_conn *cp) | ||
| 1221 | { | ||
| 1222 | return atomic_inc_not_zero(&cp->refcnt); | ||
| 1223 | } | ||
| 1224 | |||
| 1184 | /* put back the conn without restarting its timer */ | 1225 | /* put back the conn without restarting its timer */ |
| 1185 | static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) | 1226 | static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) |
| 1186 | { | 1227 | { |
| 1228 | smp_mb__before_atomic_dec(); | ||
| 1187 | atomic_dec(&cp->refcnt); | 1229 | atomic_dec(&cp->refcnt); |
| 1188 | } | 1230 | } |
| 1189 | extern void ip_vs_conn_put(struct ip_vs_conn *cp); | 1231 | extern void ip_vs_conn_put(struct ip_vs_conn *cp); |
| @@ -1298,8 +1340,6 @@ extern void ip_vs_app_inc_put(struct ip_vs_app *inc); | |||
| 1298 | extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); | 1340 | extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); |
| 1299 | extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); | 1341 | extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); |
| 1300 | 1342 | ||
| 1301 | void ip_vs_bind_pe(struct ip_vs_service *svc, struct ip_vs_pe *pe); | ||
| 1302 | void ip_vs_unbind_pe(struct ip_vs_service *svc); | ||
| 1303 | int register_ip_vs_pe(struct ip_vs_pe *pe); | 1343 | int register_ip_vs_pe(struct ip_vs_pe *pe); |
| 1304 | int unregister_ip_vs_pe(struct ip_vs_pe *pe); | 1344 | int unregister_ip_vs_pe(struct ip_vs_pe *pe); |
| 1305 | struct ip_vs_pe *ip_vs_pe_getbyname(const char *name); | 1345 | struct ip_vs_pe *ip_vs_pe_getbyname(const char *name); |
| @@ -1346,7 +1386,8 @@ extern int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); | |||
| 1346 | extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); | 1386 | extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); |
| 1347 | extern int ip_vs_bind_scheduler(struct ip_vs_service *svc, | 1387 | extern int ip_vs_bind_scheduler(struct ip_vs_service *svc, |
| 1348 | struct ip_vs_scheduler *scheduler); | 1388 | struct ip_vs_scheduler *scheduler); |
| 1349 | extern int ip_vs_unbind_scheduler(struct ip_vs_service *svc); | 1389 | extern void ip_vs_unbind_scheduler(struct ip_vs_service *svc, |
| 1390 | struct ip_vs_scheduler *sched); | ||
| 1350 | extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); | 1391 | extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); |
| 1351 | extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); | 1392 | extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); |
| 1352 | extern struct ip_vs_conn * | 1393 | extern struct ip_vs_conn * |
| @@ -1366,17 +1407,12 @@ extern struct ip_vs_stats ip_vs_stats; | |||
| 1366 | extern int sysctl_ip_vs_sync_ver; | 1407 | extern int sysctl_ip_vs_sync_ver; |
| 1367 | 1408 | ||
| 1368 | extern struct ip_vs_service * | 1409 | extern struct ip_vs_service * |
| 1369 | ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol, | 1410 | ip_vs_service_find(struct net *net, int af, __u32 fwmark, __u16 protocol, |
| 1370 | const union nf_inet_addr *vaddr, __be16 vport); | 1411 | const union nf_inet_addr *vaddr, __be16 vport); |
| 1371 | 1412 | ||
| 1372 | static inline void ip_vs_service_put(struct ip_vs_service *svc) | 1413 | extern bool |
| 1373 | { | 1414 | ip_vs_has_real_service(struct net *net, int af, __u16 protocol, |
| 1374 | atomic_dec(&svc->usecnt); | 1415 | const union nf_inet_addr *daddr, __be16 dport); |
| 1375 | } | ||
| 1376 | |||
| 1377 | extern struct ip_vs_dest * | ||
| 1378 | ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol, | ||
| 1379 | const union nf_inet_addr *daddr, __be16 dport); | ||
| 1380 | 1416 | ||
| 1381 | extern int ip_vs_use_count_inc(void); | 1417 | extern int ip_vs_use_count_inc(void); |
| 1382 | extern void ip_vs_use_count_dec(void); | 1418 | extern void ip_vs_use_count_dec(void); |
| @@ -1388,8 +1424,18 @@ extern struct ip_vs_dest * | |||
| 1388 | ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, | 1424 | ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, |
| 1389 | __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, | 1425 | __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, |
| 1390 | __u16 protocol, __u32 fwmark, __u32 flags); | 1426 | __u16 protocol, __u32 fwmark, __u32 flags); |
| 1391 | extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); | 1427 | extern void ip_vs_try_bind_dest(struct ip_vs_conn *cp); |
| 1392 | 1428 | ||
| 1429 | static inline void ip_vs_dest_hold(struct ip_vs_dest *dest) | ||
| 1430 | { | ||
| 1431 | atomic_inc(&dest->refcnt); | ||
| 1432 | } | ||
| 1433 | |||
| 1434 | static inline void ip_vs_dest_put(struct ip_vs_dest *dest) | ||
| 1435 | { | ||
| 1436 | smp_mb__before_atomic_dec(); | ||
| 1437 | atomic_dec(&dest->refcnt); | ||
| 1438 | } | ||
| 1393 | 1439 | ||
| 1394 | /* | 1440 | /* |
| 1395 | * IPVS sync daemon data and function prototypes | 1441 | * IPVS sync daemon data and function prototypes |
| @@ -1428,7 +1474,7 @@ extern int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
| 1428 | extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | 1474 | extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, |
| 1429 | struct ip_vs_protocol *pp, int offset, | 1475 | struct ip_vs_protocol *pp, int offset, |
| 1430 | unsigned int hooknum, struct ip_vs_iphdr *iph); | 1476 | unsigned int hooknum, struct ip_vs_iphdr *iph); |
| 1431 | extern void ip_vs_dst_reset(struct ip_vs_dest *dest); | 1477 | extern void ip_vs_dest_dst_rcu_free(struct rcu_head *head); |
| 1432 | 1478 | ||
| 1433 | #ifdef CONFIG_IP_VS_IPV6 | 1479 | #ifdef CONFIG_IP_VS_IPV6 |
| 1434 | extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, | 1480 | extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, |
