Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static int ip_set_dump_start(struct netlink_callback *cb) { struct nlmsghdr *nlh = nlmsg_hdr(cb->skb); int min_len = nlmsg_total_size(sizeof(struct nfgenmsg)); struct nlattr *cda[IPSET_ATTR_CMD_MAX + 1]; struct nlattr *attr = (void *)nlh + min_len; struct sk_buff *skb = cb->skb; struct ip_set_net *inst = ip...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static int ip_set_udel(struct sk_buff *skb, const struct nfnl_info *info, const struct nlattr *const attr[]) { return ip_set_ad(info->net, info->sk, skb, IPSET_DEL, info->nlh, attr, info->extack); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static int ip_set_utest(struct sk_buff *skb, const struct nfnl_info *info, const struct nlattr *const attr[]) { struct ip_set_net *inst = ip_set_pernet(info->net); struct ip_set *set; struct nlattr *tb[IPSET_ATTR_ADT_MAX + 1] = {}; int ret = 0; u32 lineno; if (unlikely(protocol_min_...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static int ip_set_byname(struct sk_buff *skb, const struct nfnl_info *info, const struct nlattr *const attr[]) { struct ip_set_net *inst = ip_set_pernet(info->net); struct sk_buff *skb2; struct nlmsghdr *nlh2; ip_set_id_t id = IPSET_INVALID_ID; const struct ip_set *set; if (unlikel...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static int __net_init ip_set_net_init(struct net *net) { struct ip_set_net *inst = ip_set_pernet(net); struct ip_set **list; inst->ip_set_max = max_sets ? max_sets : CONFIG_IP_SET_MAX; if (inst->ip_set_max >= IPSET_INVALID_ID) inst->ip_set_max = IPSET_INVALID_ID - 1; list = kvcalloc(inst->ip_set_max, s...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static void __net_exit ip_set_net_exit(struct net *net) { struct ip_set_net *inst = ip_set_pernet(net); struct ip_set *set = NULL; ip_set_id_t i; inst->is_deleted = true; nfnl_lock(NFNL_SUBSYS_IPSET); for (i = 0; i < inst->ip_set_max; i++) { set = ip_set(inst, i); if (set) { ip_set(inst, i)...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_gen.h
static size_t mtype_ahash_memsize(const struct htype *h, const struct htable *t) { return sizeof(*h) + sizeof(*t) + ahash_sizeof_regions(t->htable_bits); } #define ahash_data(n, i, dsize) \ ((struct mtype_elem *)((n)->value + ((i) * (...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_gen.h
static void mtype_flush(struct ip_set *set) { struct htype *h = set->data; struct htable *t; struct hbucket *n; u32 r, i; t = ipset_dereference_nfnl(h->table); for (r = 0; r < ahash_numof_locks(t->htable_bits); r++) { spin_lock_bh(&t->hregion[r].lock); for (i = ahash_bucket_start(r, t->htable_bits)...
[ 1, 1 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_gen.h
static void mtype_ahash_destroy(struct ip_set *set, struct htable *t, bool ext_destroy) { struct hbucket *n; u32 i; for (i = 0; i < jhash_size(t->htable_bits); i++) { n = __ipset_dereference(hbucket(t, i)); if (!n) continue; if (set->extensions & IPSET_EXT_DESTRO...
[ 0, 1 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_gen.h
static bool mtype_same_set(const struct ip_set *a, const struct ip_set *b) { const struct htype *x = a->data; const struct htype *y = b->data; return x->maxelem == y->maxelem && a->timeout == b->timeout && #if defined(IP_SET_HASH_WITH_NETMASK) || defined(IP_SET_HASH_WITH_BITMASK) nf_inet_addr_cmp(&x->bi...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_gen.h
static int mtype_data_match(struct mtype_elem *data, const struct ip_set_ext *ext, struct ip_set_ext *mext, struct ip_set *set, u32 flags) { if (!ip_set_match_extensions(set, ext, mext, flags, data)) return 0; return mtype_do_d...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_gen.h
static void mtype_uref(struct ip_set *set, struct netlink_callback *cb, bool start) { struct htype *h = set->data; struct htable *t; if (start) { rcu_read_lock_bh(); t = ipset_dereference_bh_nfnl(h->table); atomic_inc(&t->uref); cb->args[IPSET_CB_PRIVATE] = (unsigned long)t...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ip.c
static void hash_ip4_data_next(struct hash_ip4_elem *next, const struct hash_ip4_elem *e) { next->ip = e->ip; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ip.c
static int __init hash_ip_init(void) { return ip_set_type_register(&hash_ip_type); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipmac.c
static bool hash_ipmac6_data_list(struct sk_buff *skb, const struct hash_ipmac6_elem *e) { if (nla_put_ipaddr6(skb, IPSET_ATTR_IP, &e->ip.in6) || nla_put(skb, IPSET_ATTR_ETHER, ETH_ALEN, e->ether)) goto nla_put_failure; return false; nla_put_failure: return true; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipmark.c
static void hash_ipmark6_data_next(struct hash_ipmark6_elem *next, const struct hash_ipmark6_elem *d) {}
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipmark.c
static int hash_ipmark6_kadt(struct ip_set *set, const struct sk_buff *skb, const struct xt_action_param *par, enum ipset_adt adt, struct ip_set_adt_opt *opt) { const struct hash_ipmark6 *h = set->data; ipset_adtfn adtfn = set->variant->adt[adt]; struct h...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipmark.c
static void __exit hash_ipmark_fini(void) { rcu_barrier(); ip_set_type_unregister(&hash_ipmark_type); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipport.c
static bool hash_ipport4_data_list(struct sk_buff *skb, const struct hash_ipport4_elem *data) { if (nla_put_ipaddr4(skb, IPSET_ATTR_IP, data->ip) || nla_put_net16(skb, IPSET_ATTR_PORT, data->port) || nla_put_u8(skb, IPSET_ATTR_PROTO, data->proto)) goto nla_put_failu...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipport.c
static void hash_ipport4_data_next(struct hash_ipport4_elem *next, const struct hash_ipport4_elem *d) { next->ip = d->ip; next->port = d->port; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipport.c
static int hash_ipport4_kadt(struct ip_set *set, const struct sk_buff *skb, const struct xt_action_param *par, enum ipset_adt adt, struct ip_set_adt_opt *opt) { ipset_adtfn adtfn = set->variant->adt[adt]; struct hash_ipport4_elem e = {.ip = 0}; struct ip_...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipportip.c
static bool hash_ipportip4_data_equal(const struct hash_ipportip4_elem *ip1, const struct hash_ipportip4_elem *ip2, u32 *multi) { return ip1->ip == ip2->ip && ip1->ip2 == ip2->ip2 && ip1->port == ip2->port && ip1->proto == ip2->prot...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipportip.c
static bool hash_ipportip4_data_list(struct sk_buff *skb, const struct hash_ipportip4_elem *data) { if (nla_put_ipaddr4(skb, IPSET_ATTR_IP, data->ip) || nla_put_ipaddr4(skb, IPSET_ATTR_IP2, data->ip2) || nla_put_net16(skb, IPSET_ATTR_PORT, data->port) || nla_put...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipportip.c
static int hash_ipportip4_kadt(struct ip_set *set, const struct sk_buff *skb, const struct xt_action_param *par, enum ipset_adt adt, struct ip_set_adt_opt *opt) { ipset_adtfn adtfn = set->variant->adt[adt]; struct hash_ipportip4_elem e = {.ip = 0}; st...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipportip.c
static bool hash_ipportip6_data_list(struct sk_buff *skb, const struct hash_ipportip6_elem *data) { if (nla_put_ipaddr6(skb, IPSET_ATTR_IP, &data->ip.in6) || nla_put_ipaddr6(skb, IPSET_ATTR_IP2, &data->ip2.in6) || nla_put_net16(skb, IPSET_ATTR_PORT, data->port) || ...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipportip.c
static int hash_ipportip6_kadt(struct ip_set *set, const struct sk_buff *skb, const struct xt_action_param *par, enum ipset_adt adt, struct ip_set_adt_opt *opt) { ipset_adtfn adtfn = set->variant->adt[adt]; struct hash_ipportip6_elem e = {.ip = {.all = ...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipportnet.c
static int hash_ipportnet4_do_data_match(const struct hash_ipportnet4_elem *elem) { return elem->nomatch ? -ENOTEMPTY : 1; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipportnet.c
static void hash_ipportnet4_data_set_flags(struct hash_ipportnet4_elem *elem, u32 flags) { elem->nomatch = !!((flags >> 16) & IPSET_FLAG_NOMATCH); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipportnet.c
static void hash_ipportnet4_data_next(struct hash_ipportnet4_elem *next, const struct hash_ipportnet4_elem *d) { next->ip = d->ip; next->port = d->port; next->ip2 = d->ip2; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipportnet.c
static bool hash_ipportnet6_data_equal(const struct hash_ipportnet6_elem *ip1, const struct hash_ipportnet6_elem *ip2, u32 *multi) { return ipv6_addr_equal(&ip1->ip.in6, &ip2->ip.in6) && ipv6_addr_equal(&ip1->ip2.in6, &ip2->ip2.in6...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_ipportnet.c
static void hash_ipportnet6_data_set_flags(struct hash_ipportnet6_elem *elem, u32 flags) { elem->nomatch = !!((flags >> 16) & IPSET_FLAG_NOMATCH); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_mac.c
static int hash_mac4_uadt(struct ip_set *set, struct nlattr *tb[], enum ipset_adt adt, u32 *lineno, u32 flags, bool retried) { ipset_adtfn adtfn = set->variant->adt[adt]; struct hash_mac4_elem e = {{.foo[0] = 0, .foo[1] = 0}}; struct ip_set_ext ext = IP_SET_INI...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_net.c
static bool hash_net4_data_equal(const struct hash_net4_elem *ip1, const struct hash_net4_elem *ip2, u32 *multi) { return ip1->ip == ip2->ip && ip1->cidr == ip2->cidr; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_net.c
static void hash_net4_data_reset_flags(struct hash_net4_elem *elem, u8 *flags) { swap(*flags, elem->nomatch); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_net.c
static void hash_net6_data_netmask(struct hash_net6_elem *elem, u8 cidr) { ip6_netmask(&elem->ip, cidr); elem->cidr = cidr; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_net.c
static int hash_net6_uadt(struct ip_set *set, struct nlattr *tb[], enum ipset_adt adt, u32 *lineno, u32 flags, bool retried) { ipset_adtfn adtfn = set->variant->adt[adt]; struct hash_net6_elem e = {.cidr = HOST_MASK}; struct ip_set_ext ext = IP_SET_INIT_UEXT(se...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netiface.c
static int hash_netiface4_do_data_match(const struct hash_netiface4_elem *elem) { return elem->nomatch ? -ENOTEMPTY : 1; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netiface.c
static bool hash_netiface4_data_list(struct sk_buff *skb, const struct hash_netiface4_elem *data) { u32 flags = (data->physdev ? IPSET_FLAG_PHYSDEV : 0) | (data->wildcard ? IPSET_FLAG_IFACE_WILDCARD : 0); if (data->nomatch) flags |= IPSET_FLAG_NOMATCH; if (...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netiface.c
static const char *get_physoutdev_name(const struct sk_buff *skb) { struct net_device *dev = nf_bridge_get_physoutdev(skb); return dev ? dev->name : NULL; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netiface.c
static void hash_netiface6_data_netmask(struct hash_netiface6_elem *elem, u8 cidr) { ip6_netmask(&elem->ip, cidr); elem->cidr = cidr; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netiface.c
static void hash_netiface6_data_next(struct hash_netiface6_elem *next, const struct hash_netiface6_elem *d) {}
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netiface.c
static int hash_netiface6_kadt(struct ip_set *set, const struct sk_buff *skb, const struct xt_action_param *par, enum ipset_adt adt, struct ip_set_adt_opt *opt) { struct hash_netiface6 *h = set->data; ipset_adtfn adtfn = set->variant->adt[adt]; struct...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netiface.c
static int __init hash_netiface_init(void) { return ip_set_type_register(&hash_netiface_type); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netnet.c
static int hash_netnet4_do_data_match(const struct hash_netnet4_elem *elem) { return elem->nomatch ? -ENOTEMPTY : 1; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netnet.c
static void hash_netnet4_data_reset_flags(struct hash_netnet4_elem *elem, u8 *flags) { swap(*flags, elem->nomatch); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netnet.c
static void hash_netnet4_data_netmask(struct hash_netnet4_elem *elem, u8 cidr, bool inner) { if (inner) { elem->ip[1] &= ip_set_netmask(cidr); elem->cidr[1] = cidr; } else { elem->ip[0] &= ip_set_netmask(cidr); elem->cidr[0] = cidr; } }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netnet.c
static bool hash_netnet4_data_list(struct sk_buff *skb, const struct hash_netnet4_elem *data) { u32 flags = data->nomatch ? IPSET_FLAG_NOMATCH : 0; if (nla_put_ipaddr4(skb, IPSET_ATTR_IP, data->ip[0]) || nla_put_ipaddr4(skb, IPSET_ATTR_IP2, data->ip[1]) || nla_put_u8...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netnet.c
static int hash_netnet6_do_data_match(const struct hash_netnet6_elem *elem) { return elem->nomatch ? -ENOTEMPTY : 1; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netnet.c
static void hash_netnet6_data_set_flags(struct hash_netnet6_elem *elem, u32 flags) { elem->nomatch = (flags >> 16) & IPSET_FLAG_NOMATCH; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netnet.c
static void hash_netnet6_init(struct hash_netnet6_elem *e) { e->cidr[0] = HOST_MASK; e->cidr[1] = HOST_MASK; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netnet.c
static int __init hash_netnet_init(void) { return ip_set_type_register(&hash_netnet_type); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netport.c
static bool hash_netport6_data_equal(const struct hash_netport6_elem *ip1, const struct hash_netport6_elem *ip2, u32 *multi) { return ipv6_addr_equal(&ip1->ip.in6, &ip2->ip.in6) && ip1->port == ip2->port && ip1->proto == ip2->proto && ...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netport.c
static void hash_netport6_data_netmask(struct hash_netport6_elem *elem, u8 cidr) { ip6_netmask(&elem->ip, cidr); elem->cidr = cidr - 1; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netport.c
static bool hash_netport6_data_list(struct sk_buff *skb, const struct hash_netport6_elem *data) { u32 flags = data->nomatch ? IPSET_FLAG_NOMATCH : 0; if (nla_put_ipaddr6(skb, IPSET_ATTR_IP, &data->ip.in6) || nla_put_net16(skb, IPSET_ATTR_PORT, data->port) || nla_put...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netportnet.c
static bool hash_netportnet4_data_equal(const struct hash_netportnet4_elem *ip1, const struct hash_netportnet4_elem *ip2, u32 *multi) { return ip1->ipcmp == ip2->ipcmp && ip1->ccmp == ip2->ccmp && ip1->port == ip2->port && ip1->p...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netportnet.c
static void hash_netportnet4_data_next(struct hash_netportnet4_elem *next, const struct hash_netportnet4_elem *d) { next->ipcmp = d->ipcmp; next->port = d->port; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netportnet.c
static void hash_netportnet4_init(struct hash_netportnet4_elem *e) { e->cidr[0] = HOST_MASK; e->cidr[1] = HOST_MASK; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netportnet.c
static int hash_netportnet6_do_data_match(const struct hash_netportnet6_elem *elem) { return elem->nomatch ? -ENOTEMPTY : 1; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netportnet.c
static void hash_netportnet6_data_reset_flags(struct hash_netportnet6_elem *elem, u8 *flags) { swap(*flags, elem->nomatch); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netportnet.c
static void hash_netportnet6_data_reset_elem(struct hash_netportnet6_elem *elem, struct hash_netportnet6_elem *orig) { elem->ip[1] = orig->ip[1]; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netportnet.c
static void hash_netportnet6_data_netmask(struct hash_netportnet6_elem *elem, u8 cidr, bool inner) { if (inner) { ip6_netmask(&elem->ip[1], cidr); elem->cidr[1] = cidr; } else { ip6_netmask(&elem->ip[0], cidr); elem->cidr[0] = cidr; } }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_hash_netportnet.c
static int __init hash_netportnet_init(void) { return ip_set_type_register(&hash_netportnet_type); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_list_set.c
static int list_set_ktest(struct ip_set *set, const struct sk_buff *skb, const struct xt_action_param *par, struct ip_set_adt_opt *opt, const struct ip_set_ext *ext) { struct list_set *map = set->data; struct ip_set_ext *mext = &opt->ext;...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_list_set.c
static void list_set_del(struct ip_set *set, struct set_elem *e) { struct list_set *map = set->data; set->elements--; list_del_rcu(&e->list); ip_set_put_byindex(map->net, e->id); call_rcu(&e->rcu, __list_set_del_rcu); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_list_set.c
static int list_set_udel(struct ip_set *set, void *value, const struct ip_set_ext *ext, struct ip_set_ext *mext, u32 flags) { struct list_set *map = set->data; struct set_adt_elem *d = value; struct set_elem *e, *next, *prev = NULL; list_for_each_entry(e, &map...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_list_set.c
static void list_set_flush(struct ip_set *set) { struct list_set *map = set->data; struct set_elem *e, *n; list_for_each_entry_safe(e, n, &map->members, list) list_set_del(set, e); set->elements = 0; set->ext_size = 0; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_list_set.c
static int list_set_list(const struct ip_set *set, struct sk_buff *skb, struct netlink_callback *cb) { const struct list_set *map = set->data; struct nlattr *atd, *nested; u32 i = 0, first = cb->args[IPSET_CB_ARG0]; char name[IPSET_MAXNAMELEN]; struct set_elem *e; int ret = 0; at...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_list_set.c
static int list_set_create(struct net *net, struct ip_set *set, struct nlattr *tb[], u32 flags) { u32 size = IP_SET_LIST_DEFAULT_SIZE; if (unlikely(!ip_set_optattr_netorder(tb, IPSET_ATTR_SIZE) || !ip_set_optattr_netorder(tb, IPSET_ATTR_TIMEOUT) || !ip_set_...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/pfxlen.c
u32 ip_set_range_to_cidr(u32 from, u32 to, u8 *cidr) { u32 last; u8 i; for (i = 1; i < 32; i++) { if ((from & ip_set_hostmask(i)) != from) continue; last = from | ~ip_set_hostmask(i); if (!after(last, to)) { *cidr = i; return last; } } *cidr = 32; return from; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_app.c
static int ip_vs_app_inc_new(struct netns_ipvs *ipvs, struct ip_vs_app *app, __u16 proto, __u16 port) { struct ip_vs_protocol *pp; struct ip_vs_app *inc; int ret; if (!(pp = ip_vs_proto_get(proto))) return -EPROTONOSUPPORT; if (!pp->unregister_app) return -EOPNOTSUPP; ...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_app.c
static void ip_vs_app_inc_release(struct netns_ipvs *ipvs, struct ip_vs_app *inc) { struct ip_vs_protocol *pp; if (!(pp = ip_vs_proto_get(inc->protocol))) return; if (pp->unregister_app) pp->unregister_app(ipvs, inc); IP_VS_DBG(9, "%s App %s:%u unregistered\n", pp->n...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_app.c
struct ip_vs_app *register_ip_vs_app(struct netns_ipvs *ipvs, struct ip_vs_app *app) { struct ip_vs_app *a; int err = 0; mutex_lock(&__ip_vs_app_mutex); if (!ip_vs_use_count_inc()) { err = -ENOENT; goto out_unlock; } list_for_each_entry(a, &ipvs->app_list, a_l...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_app.c
void unregister_ip_vs_app(struct netns_ipvs *ipvs, struct ip_vs_app *app) { struct ip_vs_app *a, *anxt, *inc, *nxt; mutex_lock(&__ip_vs_app_mutex); list_for_each_entry_safe(a, anxt, &ipvs->app_list, a_list) { if (app && strcmp(app->name, a->name)) continue; list_for_each_entry_safe(inc, nxt, &a->i...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_app.c
int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp) { return pp->app_conn_bind(cp); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_app.c
int ip_vs_app_pkt_out(struct ip_vs_conn *cp, struct sk_buff *skb, struct ip_vs_iphdr *ipvsh) { struct ip_vs_app *app; if ((app = cp->app) == NULL) return 1; /* TCP is complicated */ if (cp->protocol == IPPROTO_TCP) return app_tcp_pkt_out(cp, skb, app, ipvsh); /* * Call priv...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_app.c
static inline int app_tcp_pkt_in(struct ip_vs_conn *cp, struct sk_buff *skb, struct ip_vs_app *app, struct ip_vs_iphdr *ipvsh) { int diff; const unsigned int tcp_offset = ip_hdrlen(skb); struct tcphdr *th; __u32 seq; if (skb_ensure_writable(sk...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_conn.c
static inline int ip_vs_conn_unhash(struct ip_vs_conn *cp) { unsigned int hash; int ret; hash = ip_vs_conn_hashkey_conn(cp); ct_write_lock_bh(hash); spin_lock(&cp->lock); if (cp->flags & IP_VS_CONN_F_HASHED) { hlist_del_rcu(&cp->c_list); cp->flags &= ~IP_VS_CONN_F_HASHED; refcount_dec(&cp->re...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_conn.c
struct ip_vs_conn *ip_vs_conn_in_get_proto(struct netns_ipvs *ipvs, int af, const struct sk_buff *skb, const struct ip_vs_iphdr *iph) { struct ip_vs_conn_param p; if (ip_vs_conn_fill_param_proto(ipvs, af, skb, iph, &p)) retu...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_conn.c
static inline void ip_vs_bind_xmit(struct ip_vs_conn *cp) { switch (IP_VS_FWD_METHOD(cp)) { case IP_VS_CONN_F_MASQ: cp->packet_xmit = ip_vs_nat_xmit; break; case IP_VS_CONN_F_TUNNEL: #ifdef CONFIG_IP_VS_IPV6 if (cp->daf == AF_INET6) cp->packet_xmit = ip_vs_tunnel_xmit_v6; else #endif ...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_conn.c
static inline void ip_vs_bind_xmit_v6(struct ip_vs_conn *cp) { switch (IP_VS_FWD_METHOD(cp)) { case IP_VS_CONN_F_MASQ: cp->packet_xmit = ip_vs_nat_xmit_v6; break; case IP_VS_CONN_F_TUNNEL: if (cp->daf == AF_INET6) cp->packet_xmit = ip_vs_tunnel_xmit_v6; else cp->packet_xmit = ip_vs_tu...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_conn.c
static inline void ip_vs_unbind_dest(struct ip_vs_conn *cp) { struct ip_vs_dest *dest = cp->dest; if (!dest) return; IP_VS_DBG_BUF(7, "Unbind-dest %s c:%s:%d v:%s:%d " "d:%s:%d fwd:%c s:%u conn->flags:%X conn->refcnt:%d " "dest->refcnt:%d\n", i...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_conn.c
static void ip_vs_conn_del_put(struct ip_vs_conn *cp) { if (del_timer(&cp->timer)) { if (cp->control) cp->timeout = 0; __ip_vs_conn_put(cp); ip_vs_conn_expire(&cp->timer); } else { __ip_vs_conn_put(cp); } }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_conn.c
static inline int todrop_entry(struct ip_vs_conn *cp) { static const signed char todrop_rate[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; static signed char todrop_counter[9] = {0}; int i; /* if the conn entry hasn't lasted for 60 seconds, don't drop it. This will leave enough time for normal connection to get ...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_conn.c
void ip_vs_random_dropentry(struct netns_ipvs *ipvs) { int idx; struct ip_vs_conn *cp; rcu_read_lock(); for (idx = 0; idx < (ip_vs_conn_tab_size >> 5); idx++) { unsigned int hash = get_random_u32() & ip_vs_conn_tab_mask; hlist_for_each_entry_rcu(cp, &ip_vs_conn_tab[hash], c_list) { if (cp->ipvs...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_conn.c
static void ip_vs_conn_flush(struct netns_ipvs *ipvs) { int idx; struct ip_vs_conn *cp, *cp_c; flush_again: rcu_read_lock(); for (idx = 0; idx < ip_vs_conn_tab_size; idx++) { hlist_for_each_entry_rcu(cp, &ip_vs_conn_tab[idx], c_list) { if (cp->ipvs != ipvs) continue; if (atomic_read(&c...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_conn.c
int __net_init ip_vs_conn_net_init(struct netns_ipvs *ipvs) { atomic_set(&ipvs->conn_count, 0); #ifdef CONFIG_PROC_FS if (!proc_create_net("ip_vs_conn", 0, ipvs->net->proc_net, &ip_vs_conn_seq_ops, sizeof(struct ip_vs_iter_state))) goto err_conn; if (!proc_create_net("ip_vs_conn_sync"...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_core.c
static inline int ip_vs_conn_fill_param_persist( const struct ip_vs_service *svc, struct sk_buff *skb, int protocol, const union nf_inet_addr *caddr, __be16 cport, const union nf_inet_addr *vaddr, __be16 vport, struct ip_vs_conn_param *p) { ip_vs_conn_fill_param(svc->ipvs, svc->af, protocol, caddr, cport...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_core.c
static int sysctl_snat_reroute(struct netns_ipvs *ipvs) { return ipvs->sysctl_snat_reroute; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_core.c
static inline bool is_new_conn_expected(const struct ip_vs_conn *cp, int conn_reuse_mode) { if (cp->control) return false; switch (cp->protocol) { case IPPROTO_TCP: return (cp->state == IP_VS_TCP_S_TIME_WAIT) || (cp->state == IP_VS_TCP_S_CLOSE) || ...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_core.c
static struct ip_vs_conn *__ip_vs_rs_conn_out(unsigned int hooknum, struct netns_ipvs *ipvs, int af, struct sk_buff *skb, const struct ip_vs_iphdr *iph) { struct ip_vs_dest *dest; ...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_core.c
static unsigned int ip_vs_try_to_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb, struct ip_vs_proto_data *pd, int *verdict, struct ip_vs_conn **cpp, ...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_core.c
int ip_vs_register_hooks(struct netns_ipvs *ipvs, unsigned int af) { const struct nf_hook_ops *ops; unsigned int count; unsigned int afmask; int ret = 0; if (af == AF_INET6) { #ifdef CONFIG_IP_VS_IPV6 ops = ip_vs_ops6; count = ARRAY_SIZE(ip_vs_ops6); afmask = 2; #else return -EINVAL; #endif ...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_ctl.c
static bool __ip_vs_addr_is_local_v6(struct net *net, const struct in6_addr *addr) { struct flowi6 fl6 = { .daddr = *addr, }; struct dst_entry *dst = ip6_route_output(net, NULL, &fl6); bool is_local; is_local = !dst->error && dst->dev && (dst->dev->flags & IFF_LOOPB...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_ctl.c
static void defense_work_handler(struct work_struct *work) { struct netns_ipvs *ipvs = container_of(work, struct netns_ipvs, defense_work.work); update_defense_level(ipvs); if (atomic_read(&ipvs->dropentry)) ip_vs_random_dropentry(ipvs); queue_delayed_work(system_long_wq, &ipvs->defense_work, DEFENS...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_ctl.c
int ip_vs_use_count_inc(void) { return try_module_get(THIS_MODULE); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_ctl.c
void ip_vs_use_count_dec(void) { module_put(THIS_MODULE); } #define IP_VS_SVC_TAB_BITS 8 #define IP_VS_SVC_TAB_SIZE (1 << IP_VS_SVC_TAB_BITS) #define IP_VS_SVC_TAB_MASK (IP_VS_SVC_TAB_SIZE - 1)
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_ctl.c
static int ip_vs_svc_unhash(struct ip_vs_service *svc) { if (!(svc->flags & IP_VS_SVC_F_HASHED)) { pr_err("%s(): request for unhash flagged, called from %pS\n", __func__, __builtin_return_address(0)); return 0; } if (svc->fwmark == 0) { hlist_del_rcu(&svc->s_list); } else { /* Remov...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_ctl.c
static inline struct ip_vs_service * __ip_vs_svc_fwm_find(struct netns_ipvs *ipvs, int af, __u32 fwmark) { unsigned int hash; struct ip_vs_service *svc; hash = ip_vs_svc_fwm_hashkey(ipvs, fwmark); hlist_for_each_entry_rcu(svc, &ip_vs_svc_fwm_table[hash], f_list) { if (svc->fwmark == fwmark && svc->af == a...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_ctl.c
static void ip_vs_rs_hash(struct netns_ipvs *ipvs, struct ip_vs_dest *dest) { unsigned int hash; __be16 port; if (dest->in_rs_table) return; switch (IP_VS_DFWD_METHOD(dest)) { case IP_VS_CONN_F_MASQ: port = dest->port; break; case IP_VS_CONN_F_TUNNEL: switch (dest->tun_type) { case IP_...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipvs/ip_vs_ctl.c
static void ip_vs_rs_unhash(struct ip_vs_dest *dest) { if (dest->in_rs_table) { hlist_del_rcu(&dest->d_list); dest->in_rs_table = 0; } }
[ 0, 0 ]