Lines Matching +full:int +full:- +full:fwd +full:- +full:mask
1 /* SPDX-License-Identifier: GPL-2.0 */
40 return net->ipvs; in net_ipvs()
44 extern int ip_vs_conn_tab_size;
49 int hdr_flags; /* ipvs flags */
60 static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset, in frag_safe_skb_hp()
61 int len, void *buffer) in frag_safe_skb_hp()
70 static inline int
71 ip_vs_fill_iph_skb_off(int af, const struct sk_buff *skb, int offset, in ip_vs_fill_iph_skb_off()
72 int hdr_flags, struct ip_vs_iphdr *iphdr) in ip_vs_fill_iph_skb_off()
74 iphdr->hdr_flags = hdr_flags; in ip_vs_fill_iph_skb_off()
75 iphdr->off = offset; in ip_vs_fill_iph_skb_off()
85 iphdr->saddr.in6 = iph->saddr; in ip_vs_fill_iph_skb_off()
86 iphdr->daddr.in6 = iph->daddr; in ip_vs_fill_iph_skb_off()
88 iphdr->len = offset; in ip_vs_fill_iph_skb_off()
89 iphdr->flags = 0; in ip_vs_fill_iph_skb_off()
90 iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1, in ip_vs_fill_iph_skb_off()
91 &iphdr->fragoffs, in ip_vs_fill_iph_skb_off()
92 &iphdr->flags); in ip_vs_fill_iph_skb_off()
93 if (iphdr->protocol < 0) in ip_vs_fill_iph_skb_off()
104 iphdr->len = offset + iph->ihl * 4; in ip_vs_fill_iph_skb_off()
105 iphdr->fragoffs = 0; in ip_vs_fill_iph_skb_off()
106 iphdr->protocol = iph->protocol; in ip_vs_fill_iph_skb_off()
107 iphdr->saddr.ip = iph->saddr; in ip_vs_fill_iph_skb_off()
108 iphdr->daddr.ip = iph->daddr; in ip_vs_fill_iph_skb_off()
114 static inline int
115 ip_vs_fill_iph_skb_icmp(int af, const struct sk_buff *skb, int offset, in ip_vs_fill_iph_skb_icmp()
118 int hdr_flags = IP_VS_HDR_ICMP; in ip_vs_fill_iph_skb_icmp()
126 static inline int
127 ip_vs_fill_iph_skb(int af, const struct sk_buff *skb, bool inverse, in ip_vs_fill_iph_skb()
130 int hdr_flags = 0; in ip_vs_fill_iph_skb()
142 return !!(iph->hdr_flags & IP_VS_HDR_INVERSE); in ip_vs_iph_inverse()
148 return !!(iph->hdr_flags & IP_VS_HDR_ICMP); in ip_vs_iph_icmp()
151 static inline void ip_vs_addr_copy(int af, union nf_inet_addr *dst, in ip_vs_addr_copy()
156 dst->in6 = src->in6; in ip_vs_addr_copy()
159 dst->ip = src->ip; in ip_vs_addr_copy()
162 static inline void ip_vs_addr_set(int af, union nf_inet_addr *dst, in ip_vs_addr_set()
167 dst->in6 = src->in6; in ip_vs_addr_set()
171 dst->ip = src->ip; in ip_vs_addr_set()
172 dst->all[1] = 0; in ip_vs_addr_set()
173 dst->all[2] = 0; in ip_vs_addr_set()
174 dst->all[3] = 0; in ip_vs_addr_set()
177 static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a, in ip_vs_addr_equal()
182 return ipv6_addr_equal(&a->in6, &b->in6); in ip_vs_addr_equal()
184 return a->ip == b->ip; in ip_vs_addr_equal()
190 int ip_vs_get_debug_level(void);
192 static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len, in ip_vs_dbg_addr()
194 int *idx) in ip_vs_dbg_addr()
196 int len; in ip_vs_dbg_addr()
199 len = snprintf(&buf[*idx], buf_len - *idx, "[%pI6c]", in ip_vs_dbg_addr()
200 &addr->in6) + 1; in ip_vs_dbg_addr()
203 len = snprintf(&buf[*idx], buf_len - *idx, "%pI4", in ip_vs_dbg_addr()
204 &addr->ip) + 1; in ip_vs_dbg_addr()
208 return &buf[*idx - len]; in ip_vs_dbg_addr()
214 int ip_vs_dbg_idx = 0; \
221 int ip_vs_dbg_idx = 0; \
244 pp->debug_packet(af, pp, skb, ofs, msg); \
250 pp->debug_packet(af, pp, skb, ofs, msg); \
368 s32 ktid:16, /* kthread ID, -1=temp list */
374 * IPVS statistics object, 64-bit kernel version of struct ip_vs_stats_user
403 int ip_vs_stats_init_alloc(struct ip_vs_stats *s);
410 /* Estimation uses a 2-second period containing ticks (in jiffies) */
448 int chain_len[IPVS_EST_TICK_CHAINS];
459 int tick_len[IPVS_EST_NTICKS]; /* est count */
460 int id; /* ktid per netns */
461 int chain_max; /* max ests per tick chain */
462 int tick_max; /* max ests per tick */
463 int est_count; /* attached ests to kthread */
464 int est_max_count; /* max ests per kthread */
465 int add_row; /* row for new ests */
466 int est_row; /* estimated row */
481 int dont_defrag;
487 int (*init_netns)(struct netns_ipvs *ipvs, struct ip_vs_proto_data *pd);
491 int (*conn_schedule)(struct netns_ipvs *ipvs,
492 int af, struct sk_buff *skb,
494 int *verdict, struct ip_vs_conn **cpp,
499 int af,
505 int af,
509 int (*snat_handler)(struct sk_buff *skb, struct ip_vs_protocol *pp,
512 int (*dnat_handler)(struct sk_buff *skb, struct ip_vs_protocol *pp,
515 const char *(*state_name)(int state);
517 void (*state_transition)(struct ip_vs_conn *cp, int direction,
521 int (*register_app)(struct netns_ipvs *ipvs, struct ip_vs_app *inc);
525 int (*app_conn_bind)(struct ip_vs_conn *cp);
527 void (*debug_packet)(int af, struct ip_vs_protocol *pp,
529 int offset,
532 void (*timeout_change)(struct ip_vs_proto_data *pd, int flags);
539 int *timeout_table; /* protocol timeout table */
604 int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp,
643 unsigned int flags; /* virtual service flags */
644 unsigned int timeout; /* persistent timeout in sec */
655 unsigned int conn_flags; /* connection flags */
656 int weight; /* destination weight */
677 struct hlist_node f_list; /* for fwmark-based service table */
685 unsigned int flags; /* service status flags */
686 unsigned int timeout; /* persistent timeout in ticks */
687 __be32 netmask; /* grouping granularity, mask/plen */
690 struct list_head destinations; /* real server d-linked list */
701 int conntrack_afmask;
724 volatile unsigned int flags; /* dest status flags */
756 unsigned int in_rs_table:1; /* we are in rs_table */
761 struct list_head n_list; /* d-linked list head */
767 int (*init_service)(struct ip_vs_service *svc);
771 int (*add_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest);
773 int (*del_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest);
775 int (*upd_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest);
785 struct list_head n_list; /* d-linked list head */
791 int (*fill_param)(struct ip_vs_conn_param *p, struct sk_buff *skb);
796 int (*show_pe_data)(const struct ip_vs_conn *cp, char *buf);
797 /* create connections for real-server outgoing packets */
808 int type; /* IP_VS_APP_TYPE_xxx */
825 int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *,
826 struct sk_buff *, int *diff, struct ip_vs_iphdr *ipvsh);
832 int (*pkt_in)(struct ip_vs_app *, struct ip_vs_conn *,
833 struct sk_buff *, int *diff, struct ip_vs_iphdr *ipvsh);
836 int (*init_conn)(struct ip_vs_app *, struct ip_vs_conn *);
839 int (*done_conn)(struct ip_vs_app *, struct ip_vs_conn *);
843 int (*bind_conn)(struct ip_vs_app *, struct ip_vs_conn *,
848 int * timeout_table;
849 int * timeouts;
850 int timeouts_size;
852 int (*conn_schedule)(struct sk_buff *skb, struct ip_vs_app *app,
853 int *verdict, struct ip_vs_conn **cpp);
857 const struct iphdr *iph, int inverse);
861 const struct iphdr *iph, int inverse);
863 int (*state_transition)(struct ip_vs_conn *cp, int direction,
867 void (*timeout_change)(struct ip_vs_app *app, int flags);
874 unsigned int sync_queue_delay;
886 int syncid;
897 int gen; /* Generation */
898 int enable; /* enable like nf_hooks do */
902 #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1)
914 #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1)
921 #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1)
928 #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1)
938 int num_services; /* no of virtual services */
939 int num_services6; /* IPv6 virtual services */
953 /* 1/rate drop and drop-entry variables */
955 int drop_rate;
956 int drop_counter;
957 int old_secure_tcp;
964 /* sys-ctl struct */
970 int sysctl_amemthresh;
971 int sysctl_am_droprate;
972 int sysctl_drop_entry;
973 int sysctl_drop_packet;
974 int sysctl_secure_tcp;
976 int sysctl_conntrack;
978 int sysctl_snat_reroute;
979 int sysctl_sync_ver;
980 int sysctl_sync_ports;
981 int sysctl_sync_persist_mode;
983 int sysctl_sync_sock_size;
984 int sysctl_cache_bypass;
985 int sysctl_expire_nodest_conn;
986 int sysctl_sloppy_tcp;
987 int sysctl_sloppy_sctp;
988 int sysctl_expire_quiescent_template;
989 int sysctl_sync_threshold[2];
990 unsigned int sysctl_sync_refresh_period;
991 int sysctl_sync_retries;
992 int sysctl_nat_icmp_send;
993 int sysctl_pmtu_disc;
994 int sysctl_backup_only;
995 int sysctl_conn_reuse_mode;
996 int sysctl_schedule_icmp;
997 int sysctl_ignore_tunneled;
998 int sysctl_run_estimation;
1001 int est_cpulist_valid; /* cpulist set */
1002 int sysctl_est_nice; /* kthread nice */
1003 int est_stopped; /* stop tasks */
1007 int sysctl_lblc_expiration;
1011 int sysctl_lblcr_expiration;
1020 int est_calc_phase; /* Calculation phase */
1021 int est_chain_max; /* Calculated chain_max */
1022 int est_kt_count; /* Allocated ptrs */
1023 int est_add_ktid; /* ktid where to add ests */
1032 int threads_mask;
1033 volatile int sync_state;
1042 unsigned int mixed_address_family_dests;
1043 unsigned int hooks_afmask; /* &1=AF_INET, &2=AF_INET6 */
1062 static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs) in sysctl_sync_threshold()
1064 return ipvs->sysctl_sync_threshold[0]; in sysctl_sync_threshold()
1067 static inline int sysctl_sync_period(struct netns_ipvs *ipvs) in sysctl_sync_period()
1069 return READ_ONCE(ipvs->sysctl_sync_threshold[1]); in sysctl_sync_period()
1072 static inline unsigned int sysctl_sync_refresh_period(struct netns_ipvs *ipvs) in sysctl_sync_refresh_period()
1074 return READ_ONCE(ipvs->sysctl_sync_refresh_period); in sysctl_sync_refresh_period()
1077 static inline int sysctl_sync_retries(struct netns_ipvs *ipvs) in sysctl_sync_retries()
1079 return ipvs->sysctl_sync_retries; in sysctl_sync_retries()
1082 static inline int sysctl_sync_ver(struct netns_ipvs *ipvs) in sysctl_sync_ver()
1084 return ipvs->sysctl_sync_ver; in sysctl_sync_ver()
1087 static inline int sysctl_sloppy_tcp(struct netns_ipvs *ipvs) in sysctl_sloppy_tcp()
1089 return ipvs->sysctl_sloppy_tcp; in sysctl_sloppy_tcp()
1092 static inline int sysctl_sloppy_sctp(struct netns_ipvs *ipvs) in sysctl_sloppy_sctp()
1094 return ipvs->sysctl_sloppy_sctp; in sysctl_sloppy_sctp()
1097 static inline int sysctl_sync_ports(struct netns_ipvs *ipvs) in sysctl_sync_ports()
1099 return READ_ONCE(ipvs->sysctl_sync_ports); in sysctl_sync_ports()
1102 static inline int sysctl_sync_persist_mode(struct netns_ipvs *ipvs) in sysctl_sync_persist_mode()
1104 return ipvs->sysctl_sync_persist_mode; in sysctl_sync_persist_mode()
1109 return ipvs->sysctl_sync_qlen_max; in sysctl_sync_qlen_max()
1112 static inline int sysctl_sync_sock_size(struct netns_ipvs *ipvs) in sysctl_sync_sock_size()
1114 return ipvs->sysctl_sync_sock_size; in sysctl_sync_sock_size()
1117 static inline int sysctl_pmtu_disc(struct netns_ipvs *ipvs) in sysctl_pmtu_disc()
1119 return ipvs->sysctl_pmtu_disc; in sysctl_pmtu_disc()
1122 static inline int sysctl_backup_only(struct netns_ipvs *ipvs) in sysctl_backup_only()
1124 return ipvs->sync_state & IP_VS_STATE_BACKUP && in sysctl_backup_only()
1125 ipvs->sysctl_backup_only; in sysctl_backup_only()
1128 static inline int sysctl_conn_reuse_mode(struct netns_ipvs *ipvs) in sysctl_conn_reuse_mode()
1130 return ipvs->sysctl_conn_reuse_mode; in sysctl_conn_reuse_mode()
1133 static inline int sysctl_expire_nodest_conn(struct netns_ipvs *ipvs) in sysctl_expire_nodest_conn()
1135 return ipvs->sysctl_expire_nodest_conn; in sysctl_expire_nodest_conn()
1138 static inline int sysctl_schedule_icmp(struct netns_ipvs *ipvs) in sysctl_schedule_icmp()
1140 return ipvs->sysctl_schedule_icmp; in sysctl_schedule_icmp()
1143 static inline int sysctl_ignore_tunneled(struct netns_ipvs *ipvs) in sysctl_ignore_tunneled()
1145 return ipvs->sysctl_ignore_tunneled; in sysctl_ignore_tunneled()
1148 static inline int sysctl_cache_bypass(struct netns_ipvs *ipvs) in sysctl_cache_bypass()
1150 return ipvs->sysctl_cache_bypass; in sysctl_cache_bypass()
1153 static inline int sysctl_run_estimation(struct netns_ipvs *ipvs) in sysctl_run_estimation()
1155 return ipvs->sysctl_run_estimation; in sysctl_run_estimation()
1160 if (ipvs->est_cpulist_valid) in sysctl_est_cpulist()
1161 return ipvs->sysctl_est_cpulist; in sysctl_est_cpulist()
1166 static inline int sysctl_est_nice(struct netns_ipvs *ipvs) in sysctl_est_nice()
1168 return ipvs->sysctl_est_nice; in sysctl_est_nice()
1173 static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs) in sysctl_sync_threshold()
1178 static inline int sysctl_sync_period(struct netns_ipvs *ipvs) in sysctl_sync_period()
1183 static inline unsigned int sysctl_sync_refresh_period(struct netns_ipvs *ipvs) in sysctl_sync_refresh_period()
1188 static inline int sysctl_sync_retries(struct netns_ipvs *ipvs) in sysctl_sync_retries()
1193 static inline int sysctl_sync_ver(struct netns_ipvs *ipvs) in sysctl_sync_ver()
1198 static inline int sysctl_sloppy_tcp(struct netns_ipvs *ipvs) in sysctl_sloppy_tcp()
1203 static inline int sysctl_sloppy_sctp(struct netns_ipvs *ipvs) in sysctl_sloppy_sctp()
1208 static inline int sysctl_sync_ports(struct netns_ipvs *ipvs) in sysctl_sync_ports()
1213 static inline int sysctl_sync_persist_mode(struct netns_ipvs *ipvs) in sysctl_sync_persist_mode()
1223 static inline int sysctl_sync_sock_size(struct netns_ipvs *ipvs) in sysctl_sync_sock_size()
1228 static inline int sysctl_pmtu_disc(struct netns_ipvs *ipvs) in sysctl_pmtu_disc()
1233 static inline int sysctl_backup_only(struct netns_ipvs *ipvs) in sysctl_backup_only()
1238 static inline int sysctl_conn_reuse_mode(struct netns_ipvs *ipvs) in sysctl_conn_reuse_mode()
1243 static inline int sysctl_expire_nodest_conn(struct netns_ipvs *ipvs) in sysctl_expire_nodest_conn()
1248 static inline int sysctl_schedule_icmp(struct netns_ipvs *ipvs) in sysctl_schedule_icmp()
1253 static inline int sysctl_ignore_tunneled(struct netns_ipvs *ipvs) in sysctl_ignore_tunneled()
1258 static inline int sysctl_cache_bypass(struct netns_ipvs *ipvs) in sysctl_cache_bypass()
1263 static inline int sysctl_run_estimation(struct netns_ipvs *ipvs) in sysctl_run_estimation()
1273 static inline int sysctl_est_nice(struct netns_ipvs *ipvs) in sysctl_est_nice()
1283 const char *ip_vs_proto_name(unsigned int proto);
1284 void ip_vs_init_hash_table(struct list_head *table, int rows);
1305 static inline void ip_vs_conn_fill_param(struct netns_ipvs *ipvs, int af, int protocol, in ip_vs_conn_fill_param()
1312 p->ipvs = ipvs; in ip_vs_conn_fill_param()
1313 p->af = af; in ip_vs_conn_fill_param()
1314 p->protocol = protocol; in ip_vs_conn_fill_param()
1315 p->caddr = caddr; in ip_vs_conn_fill_param()
1316 p->cport = cport; in ip_vs_conn_fill_param()
1317 p->vaddr = vaddr; in ip_vs_conn_fill_param()
1318 p->vport = vport; in ip_vs_conn_fill_param()
1319 p->pe = NULL; in ip_vs_conn_fill_param()
1320 p->pe_data = NULL; in ip_vs_conn_fill_param()
1326 struct ip_vs_conn * ip_vs_conn_in_get_proto(struct netns_ipvs *ipvs, int af,
1332 struct ip_vs_conn * ip_vs_conn_out_get_proto(struct netns_ipvs *ipvs, int af,
1337 * By default, RCU read-side critical sections have access only to
1342 return refcount_inc_not_zero(&cp->refcnt); in __ip_vs_conn_get()
1349 refcount_dec(&cp->refcnt); in __ip_vs_conn_put()
1354 struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p, int dest_af,
1356 __be16 dport, unsigned int flags,
1363 int ip_vs_check_template(struct ip_vs_conn *ct, struct ip_vs_dest *cdest);
1365 int ip_vs_conn_init(void);
1370 struct ip_vs_conn *ctl_cp = cp->control; in ip_vs_control_del()
1374 IP_VS_DBG_ADDR(cp->af, &cp->caddr), in ip_vs_control_del()
1375 ntohs(cp->cport), in ip_vs_control_del()
1376 IP_VS_DBG_ADDR(cp->af, &cp->vaddr), in ip_vs_control_del()
1377 ntohs(cp->vport)); in ip_vs_control_del()
1384 IP_VS_DBG_ADDR(cp->af, &cp->caddr), in ip_vs_control_del()
1385 ntohs(cp->cport), in ip_vs_control_del()
1386 IP_VS_DBG_ADDR(cp->af, &ctl_cp->caddr), in ip_vs_control_del()
1387 ntohs(ctl_cp->cport)); in ip_vs_control_del()
1389 cp->control = NULL; in ip_vs_control_del()
1390 if (atomic_read(&ctl_cp->n_control) == 0) { in ip_vs_control_del()
1393 IP_VS_DBG_ADDR(cp->af, &cp->caddr), in ip_vs_control_del()
1394 ntohs(cp->cport), in ip_vs_control_del()
1395 IP_VS_DBG_ADDR(cp->af, &cp->vaddr), in ip_vs_control_del()
1396 ntohs(cp->vport)); in ip_vs_control_del()
1400 atomic_dec(&ctl_cp->n_control); in ip_vs_control_del()
1406 if (cp->control) { in ip_vs_control_add()
1409 IP_VS_DBG_ADDR(cp->af, &cp->caddr), in ip_vs_control_add()
1410 ntohs(cp->cport), in ip_vs_control_add()
1411 IP_VS_DBG_ADDR(cp->af, &cp->vaddr), in ip_vs_control_add()
1412 ntohs(cp->vport)); in ip_vs_control_add()
1419 IP_VS_DBG_ADDR(cp->af, &cp->caddr), in ip_vs_control_add()
1420 ntohs(cp->cport), in ip_vs_control_add()
1421 IP_VS_DBG_ADDR(cp->af, &ctl_cp->caddr), in ip_vs_control_add()
1422 ntohs(ctl_cp->cport)); in ip_vs_control_add()
1424 cp->control = ctl_cp; in ip_vs_control_add()
1425 atomic_inc(&ctl_cp->n_control); in ip_vs_control_add()
1432 struct ip_vs_conn *ct = cp->control; in ip_vs_control_assure_ct()
1434 if (ct && !(ct->state & IP_VS_CTPL_S_ASSURED) && in ip_vs_control_assure_ct()
1435 (ct->flags & IP_VS_CONN_F_TEMPLATE)) in ip_vs_control_assure_ct()
1436 ct->state |= IP_VS_CTPL_S_ASSURED; in ip_vs_control_assure_ct()
1440 int ip_vs_estimator_net_init(struct netns_ipvs *ipvs);
1441 int ip_vs_control_net_init(struct netns_ipvs *ipvs);
1442 int ip_vs_protocol_net_init(struct netns_ipvs *ipvs);
1443 int ip_vs_app_net_init(struct netns_ipvs *ipvs);
1444 int ip_vs_conn_net_init(struct netns_ipvs *ipvs);
1445 int ip_vs_sync_net_init(struct netns_ipvs *ipvs);
1460 int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
1462 int register_ip_vs_app_inc(struct netns_ipvs *ipvs, struct ip_vs_app *app, __u16 proto,
1464 int ip_vs_app_inc_get(struct ip_vs_app *inc);
1467 int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb,
1469 int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb,
1472 int register_ip_vs_pe(struct ip_vs_pe *pe);
1473 int unregister_ip_vs_pe(struct ip_vs_pe *pe);
1479 if (pe && pe->module) \
1480 __module_get(pe->module);
1483 if (pe && pe->module) \
1484 module_put(pe->module);
1487 int ip_vs_protocol_init(void);
1489 void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags);
1490 int *ip_vs_create_timeout_table(int *table, int size);
1491 void ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp,
1492 const struct sk_buff *skb, int offset,
1505 int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1506 int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1507 int ip_vs_bind_scheduler(struct ip_vs_service *svc,
1515 struct ip_vs_proto_data *pd, int *ignored,
1517 int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
1524 extern int sysctl_ip_vs_sync_ver;
1527 ip_vs_service_find(struct netns_ipvs *ipvs, int af, __u32 fwmark, __u16 protocol,
1530 bool ip_vs_has_real_service(struct netns_ipvs *ipvs, int af, __u16 protocol,
1534 ip_vs_find_real_service(struct netns_ipvs *ipvs, int af, __u16 protocol,
1536 struct ip_vs_dest *ip_vs_find_tunnel(struct netns_ipvs *ipvs, int af,
1540 int ip_vs_use_count_inc(void);
1542 int ip_vs_register_nl_ioctl(void);
1544 int ip_vs_control_init(void);
1547 ip_vs_find_dest(struct netns_ipvs *ipvs, int svc_af, int dest_af,
1555 refcount_inc(&dest->refcnt); in ip_vs_dest_hold()
1561 refcount_dec(&dest->refcnt); in ip_vs_dest_put()
1566 if (refcount_dec_and_test(&dest->refcnt)) in ip_vs_dest_put_and_free()
1573 int start_sync_thread(struct netns_ipvs *ipvs, struct ipvs_sync_daemon_cfg *cfg,
1574 int state);
1575 int stop_sync_thread(struct netns_ipvs *ipvs, int state);
1576 void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts);
1579 int ip_vs_start_estimator(struct netns_ipvs *ipvs, struct ip_vs_stats *stats);
1584 int ip_vs_est_kthread_start(struct netns_ipvs *ipvs,
1592 ipvs->est_stopped = !sysctl_run_estimation(ipvs) || in ip_vs_est_stopped_recalc()
1593 (ipvs->est_cpulist_valid && in ip_vs_est_stopped_recalc()
1601 return ipvs->est_stopped; in ip_vs_est_stopped()
1607 static inline int ip_vs_est_max_threads(struct netns_ipvs *ipvs) in ip_vs_est_max_threads()
1609 unsigned int limit = IPVS_EST_CPU_KTHREADS * in ip_vs_est_max_threads()
1616 int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1618 int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1620 int ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1622 int ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1624 int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1626 int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1627 struct ip_vs_protocol *pp, int offset,
1628 unsigned int hooknum, struct ip_vs_iphdr *iph);
1632 int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1634 int ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1636 int ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1638 int ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1640 int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1641 struct ip_vs_protocol *pp, int offset,
1642 unsigned int hooknum, struct ip_vs_iphdr *iph);
1650 static inline int ip_vs_todrop(struct netns_ipvs *ipvs) in ip_vs_todrop()
1652 if (!ipvs->drop_rate) in ip_vs_todrop()
1654 if (--ipvs->drop_counter > 0) in ip_vs_todrop()
1656 ipvs->drop_counter = ipvs->drop_rate; in ip_vs_todrop()
1660 static inline int ip_vs_todrop(struct netns_ipvs *ipvs) { return 0; } in ip_vs_todrop()
1671 &ipvs->expire_nodest_conn_work, 1); in ip_vs_enqueue_expire_nodest_conns()
1679 #define IP_VS_DFWD_METHOD(dest) (atomic_read(&(dest)->conn_flags) & \
1683 #define IP_VS_FWD_METHOD(cp) (cp->flags & IP_VS_CONN_F_FWD_MASK)
1687 char fwd; in ip_vs_fwd_tag() local
1691 fwd = 'M'; break; in ip_vs_fwd_tag()
1693 fwd = 'L'; break; in ip_vs_fwd_tag()
1695 fwd = 'T'; break; in ip_vs_fwd_tag()
1697 fwd = 'R'; break; in ip_vs_fwd_tag()
1699 fwd = 'B'; break; in ip_vs_fwd_tag()
1701 fwd = '?'; break; in ip_vs_fwd_tag()
1703 return fwd; in ip_vs_fwd_tag()
1707 struct ip_vs_conn *cp, int dir);
1711 struct ip_vs_conn *cp, int dir);
1714 __sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset);
1749 nf_conntrack_put(&ct->ct_general); in ip_vs_notrack()
1759 static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs) in ip_vs_conntrack_enabled()
1762 return ipvs->sysctl_conntrack; in ip_vs_conntrack_enabled()
1769 int outin);
1770 int ip_vs_confirm_conntrack(struct sk_buff *skb);
1773 const __be16 port, int from_rs);
1778 static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs) in ip_vs_conntrack_enabled()
1784 struct ip_vs_conn *cp, int outin) in ip_vs_update_conntrack()
1788 static inline int ip_vs_confirm_conntrack(struct sk_buff *skb) in ip_vs_confirm_conntrack()
1813 static inline int ip_vs_register_conntrack(struct ip_vs_service *svc) in ip_vs_register_conntrack()
1816 int afmask = (svc->af == AF_INET6) ? 2 : 1; in ip_vs_register_conntrack()
1817 int ret = 0; in ip_vs_register_conntrack()
1819 if (!(svc->conntrack_afmask & afmask)) { in ip_vs_register_conntrack()
1820 ret = nf_ct_netns_get(svc->ipvs->net, svc->af); in ip_vs_register_conntrack()
1822 svc->conntrack_afmask |= afmask; in ip_vs_register_conntrack()
1833 int afmask = (svc->af == AF_INET6) ? 2 : 1; in ip_vs_unregister_conntrack()
1835 if (svc->conntrack_afmask & afmask) { in ip_vs_unregister_conntrack()
1836 nf_ct_netns_put(svc->ipvs->net, svc->af); in ip_vs_unregister_conntrack()
1837 svc->conntrack_afmask &= ~afmask; in ip_vs_unregister_conntrack()
1842 int ip_vs_register_hooks(struct netns_ipvs *ipvs, unsigned int af);
1843 void ip_vs_unregister_hooks(struct netns_ipvs *ipvs, unsigned int af);
1845 static inline int
1852 * dest->activeconns*256 + dest->inactconns in ip_vs_dest_conn_overhead()
1854 return (atomic_read(&dest->activeconns) << 8) + in ip_vs_dest_conn_overhead()
1855 atomic_read(&dest->inactconns); in ip_vs_dest_conn_overhead()
1859 INDIRECT_CALLABLE_DECLARE(int
1865 INDIRECT_CALLABLE_DECLARE(int