Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | net/xfrm/xfrm_hash.h |
static inline unsigned int __sel_hash(const struct xfrm_selector *sel,
unsigned short family, unsigned int hmask,
u8 dbits, u8 sbits) {
const xfrm_address_t *daddr = &sel->daddr;
const xfrm_address_t *saddr = &sel->saddr;
unsigned int h ... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_hash.h |
static inline unsigned int __addr_hash(const xfrm_address_t *daddr,
const xfrm_address_t *saddr,
unsigned short family,
unsigned int hmask, u8 dbits, u8 sbits) {
unsigned int h = 0;
switch (family)... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_inout.h |
static inline void xfrm6_extract_header(struct sk_buff *skb) {
#if IS_ENABLED(CONFIG_IPV6)
struct ipv6hdr *iph = ipv6_hdr(skb);
XFRM_MODE_SKB_CB(skb)->ihl = sizeof(*iph);
XFRM_MODE_SKB_CB(skb)->id = 0;
XFRM_MODE_SKB_CB(skb)->frag_off = htons(IP_DF);
XFRM_MODE_SKB_CB(skb)->tos = ipv6_get_dsfield(iph);
XFRM... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_inout.h |
static inline void xfrm6_beet_make_header(struct sk_buff *skb) {
struct ipv6hdr *iph = ipv6_hdr(skb);
iph->version = 6;
memcpy(iph->flow_lbl, XFRM_MODE_SKB_CB(skb)->flow_lbl, sizeof(iph->flow_lbl));
iph->nexthdr = XFRM_MODE_SKB_CB(skb)->protocol;
ipv6_change_dsfield(iph, 0, XFRM_MODE_SKB_CB(skb)->tos);
... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_input.c |
int xfrm_input_unregister_afinfo(const struct xfrm_input_afinfo *afinfo) {
int err = 0;
spin_lock_bh(&xfrm_input_afinfo_lock);
if (likely(xfrm_input_afinfo[afinfo->is_ipip][afinfo->family])) {
if (unlikely(xfrm_input_afinfo[afinfo->is_ipip][afinfo->family] != afinfo))
err = -EINVAL;
else
RCU... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_input.c |
static int xfrm_rcv_cb(struct sk_buff *skb, unsigned int family, u8 protocol,
int err) {
bool is_ipip = (protocol == IPPROTO_IPIP || protocol == IPPROTO_IPV6);
const struct xfrm_input_afinfo *afinfo;
int ret;
afinfo = xfrm_input_get_afinfo(family, is_ipip);
if (!afinfo)
return -EA... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_input.c | struct sec_path *secpath_set(struct sk_buff *skb) {
struct sec_path *sp, *tmp = skb_ext_find(skb, SKB_EXT_SEC_PATH);
sp = skb_ext_add(skb, SKB_EXT_SEC_PATH);
if (!sp)
return NULL;
if (tmp)
return sp;
/* allocated new secpath */
memset(sp->ovec, 0, sizeof(sp->ovec));
sp->olen = 0;
sp->len = 0;... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_input.c |
static int xfrm4_remove_tunnel_encap(struct xfrm_state *x,
struct sk_buff *skb) {
int err = -EINVAL;
if (XFRM_MODE_SKB_CB(skb)->protocol != IPPROTO_IPIP)
goto out;
if (!pskb_may_pull(skb, sizeof(struct iphdr)))
goto out;
err = skb_unclone(skb, GFP_ATOMIC);
if (... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_input.c |
static void ipip6_ecn_decapsulate(struct sk_buff *skb) {
struct ipv6hdr *inner_iph = ipipv6_hdr(skb);
if (INET_ECN_is_ce(XFRM_MODE_SKB_CB(skb)->tos))
IP6_ECN_set_ce(skb, inner_iph);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_input.c |
static int xfrm6_remove_tunnel_encap(struct xfrm_state *x,
struct sk_buff *skb) {
int err = -EINVAL;
if (XFRM_MODE_SKB_CB(skb)->protocol != IPPROTO_IPV6)
goto out;
if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
goto out;
err = skb_unclone(skb, GFP_ATOMIC);
if ... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_input.c | static int xfrm_inner_mode_encap_remove(struct xfrm_state *x,
const struct xfrm_mode *inner_mode,
struct sk_buff *skb) {
switch (inner_mode->encap) {
case XFRM_MODE_BEET:
if (inner_mode->family == AF_INET)
return xfrm4_remove_... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_input.c |
int xfrm_input_resume(struct sk_buff *skb, int nexthdr) {
return xfrm_input(skb, nexthdr, 0, -1);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_input.c |
int xfrm_trans_queue_net(struct net *net, struct sk_buff *skb,
int (*finish)(struct net *, struct sock *,
struct sk_buff *)) {
struct xfrm_trans_tasklet *trans;
trans = this_cpu_ptr(&xfrm_trans_tasklet);
if (skb_queue_len(&trans->queue) >= READ_ON... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_input.c |
int xfrm_trans_queue(struct sk_buff *skb,
int (*finish)(struct net *, struct sock *,
struct sk_buff *)) {
return xfrm_trans_queue_net(dev_net(skb->dev), skb, finish);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_input.c |
void __init xfrm_input_init(void) {
int err;
int i;
init_dummy_netdev(&xfrm_napi_dev);
err = gro_cells_init(&gro_cells, &xfrm_napi_dev);
if (err)
gro_cells.cells = NULL;
for_each_possible_cpu(i) {
struct xfrm_trans_tasklet *trans;
trans = &per_cpu(xfrm_trans_tasklet, i);
spin_lock_init(&... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_interface_core.c |
static int xfrmi_build_state(struct net *net, struct nlattr *nla,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts,
struct netlink_ext_ack *extack) {
struct nlattr *tb[LWT_XFRM_MAX + 1];
struct lwtunnel_state *ne... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_interface_core.c |
static int xfrmi_encap_cmp(struct lwtunnel_state *a, struct lwtunnel_state *b) {
struct xfrm_md_info *a_info = lwt_xfrm_info(a);
struct xfrm_md_info *b_info = lwt_xfrm_info(b);
return memcmp(a_info, b_info, sizeof(*a_info));
} | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_interface_core.c |
static u32 xfrmi_hash(u32 if_id) { return hash_32(if_id, XFRMI_HASH_BITS); } | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_interface_core.c |
static struct xfrm_if *xfrmi_lookup(struct net *net, struct xfrm_state *x) {
struct xfrmi_net *xfrmn = net_generic(net, xfrmi_net_id);
struct xfrm_if *xi;
for_each_xfrmi_rcu(xfrmn->xfrmi[xfrmi_hash(x->if_id)], xi) {
if (x->if_id == xi->p.if_id && (xi->dev->flags & IFF_UP))
return xi;
}
xi = rcu_d... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_interface_core.c |
static void xfrmi_unlink(struct xfrmi_net *xfrmn, struct xfrm_if *xi) {
struct xfrm_if __rcu **xip;
struct xfrm_if *iter;
for (xip = &xfrmn->xfrmi[xfrmi_hash(xi->p.if_id)];
(iter = rtnl_dereference(*xip)) != NULL; xip = &iter->next) {
if (xi == iter) {
rcu_assign_pointer(*xip, xi->next);
... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_interface_core.c |
static void xfrmi_dev_uninit(struct net_device *dev) {
struct xfrm_if *xi = netdev_priv(dev);
struct xfrmi_net *xfrmn = net_generic(xi->net, xfrmi_net_id);
if (xi->p.collect_md)
RCU_INIT_POINTER(xfrmn->collect_md_xfrmi, NULL);
else
xfrmi_unlink(xfrmn, xi);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_interface_core.c |
static int xfrmi_change(struct xfrm_if *xi, const struct xfrm_if_parms *p) {
if (xi->p.link != p->link)
return -EINVAL;
xi->p.if_id = p->if_id;
return 0;
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_interface_core.c |
static int xfrmi_update(struct xfrm_if *xi, struct xfrm_if_parms *p) {
struct net *net = xi->net;
struct xfrmi_net *xfrmn = net_generic(net, xfrmi_net_id);
int err;
xfrmi_unlink(xfrmn, xi);
synchronize_net();
err = xfrmi_change(xi, p);
xfrmi_link(xfrmn, xi);
netdev_state_change(xi->dev);
return err;... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_interface_core.c |
static int xfrmi_dev_init(struct net_device *dev) {
struct xfrm_if *xi = netdev_priv(dev);
struct net_device *phydev = __dev_get_by_index(xi->net, xi->p.link);
int err;
dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
if (!dev->tstats)
return -ENOMEM;
err = gro_cells_init(&xi->gro_cell... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_interface_core.c |
static void xfrmi_netlink_parms(struct nlattr *data[],
struct xfrm_if_parms *parms) {
memset(parms, 0, sizeof(*parms));
if (!data)
return;
if (data[IFLA_XFRM_LINK])
parms->link = nla_get_u32(data[IFLA_XFRM_LINK]);
if (data[IFLA_XFRM_IF_ID])
parms->if_id = nla_get_... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_interface_core.c |
static int xfrmi_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack) {
struct net *net = dev_net(dev);
struct xfrm_if_parms p = {};
struct xfrm_if *xi;
int err;
xfrmi_netlink_parms(... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_interface_core.c |
static void xfrmi_dellink(struct net_device *dev, struct list_head *head) {
unregister_netdevice_queue(dev, head);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_interface_core.c |
static int __init xfrmi6_init(void) {
int err;
err = xfrm6_protocol_register(&xfrmi_esp6_protocol, IPPROTO_ESP);
if (err < 0)
goto xfrm_proto_esp_failed;
err = xfrm6_protocol_register(&xfrmi_ah6_protocol, IPPROTO_AH);
if (err < 0)
goto xfrm_proto_ah_failed;
err = xfrm6_protocol_register(&xfrmi_ipc... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_ipcomp.c | int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb) {
int nexthdr;
int err = -ENOMEM;
struct ip_comp_hdr *ipch;
if (skb_linearize_cow(skb))
goto out;
skb->ip_summed = CHECKSUM_NONE;
ipch = (void *)skb->data;
nexthdr = ipch->nexthdr;
skb->transport_header = skb->network_header + sizeof(*i... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_ipcomp.c |
static void ipcomp_free_tfms(struct crypto_comp *__percpu *tfms) {
struct ipcomp_tfms *pos;
int cpu;
list_for_each_entry(pos, &ipcomp_tfms_list, list) {
if (pos->tfms == tfms)
break;
}
WARN_ON(list_entry_is_head(pos, &ipcomp_tfms_list, list));
if (--pos->users)
return;
list_del(&pos->li... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_ipcomp.c | static struct crypto_comp *__percpu *ipcomp_alloc_tfms(const char *alg_name) {
struct ipcomp_tfms *pos;
struct crypto_comp *__percpu *tfms;
int cpu;
list_for_each_entry(pos, &ipcomp_tfms_list, list) {
struct crypto_comp *tfm;
tfm = this_cpu_read(*pos->tfms);
if (!strcmp(crypto_comp_name(tfm), alg... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_ipcomp.c |
void ipcomp_destroy(struct xfrm_state *x) {
struct ipcomp_data *ipcd = x->data;
if (!ipcd)
return;
xfrm_state_delete_tunnel(x);
mutex_lock(&ipcomp_resource_mutex);
ipcomp_free_data(ipcd);
mutex_unlock(&ipcomp_resource_mutex);
kfree(ipcd);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_output.c | static int xfrm4_transport_output(struct xfrm_state *x, struct sk_buff *skb) {
struct iphdr *iph = ip_hdr(skb);
int ihl = iph->ihl * 4;
skb_set_inner_transport_header(skb, skb_transport_offset(skb));
skb_set_network_header(skb, -x->props.header_len);
skb->mac_header = skb->network_header + offsetof(struct i... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_output.c | static int mip6_rthdr_offset(struct sk_buff *skb, u8 **nexthdr, int type) {
const unsigned char *nh = skb_network_header(skb);
unsigned int offset = sizeof(struct ipv6hdr);
unsigned int packet_len;
int found_rhdr = 0;
packet_len = skb_tail_pointer(skb) - nh;
*nexthdr = &ipv6_hdr(skb)->nexthdr;
while (of... | [
1,
1
] |
Linux Kernel | net/xfrm/xfrm_output.c | static int xfrm4_beet_encap_add(struct xfrm_state *x, struct sk_buff *skb) {
struct ip_beet_phdr *ph;
struct iphdr *top_iph;
int hdrlen, optlen;
hdrlen = 0;
optlen = XFRM_MODE_SKB_CB(skb)->optlen;
if (unlikely(optlen))
hdrlen += IPV4_BEET_PHMAXLEN - (optlen & 4);
skb_set_network_header(skb,
... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_output.c | static int xfrm4_tunnel_encap_add(struct xfrm_state *x, struct sk_buff *skb) {
bool small_ipv6 =
(skb->protocol == htons(ETH_P_IPV6)) && (skb->len <= IPV6_MIN_MTU);
struct dst_entry *dst = skb_dst(skb);
struct iphdr *top_iph;
int flags;
skb_set_inner_network_header(skb, skb_network_offset(skb));
skb_... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_output.c |
static int xfrm_outer_mode_output(struct xfrm_state *x, struct sk_buff *skb) {
switch (x->outer_mode.encap) {
case XFRM_MODE_BEET:
case XFRM_MODE_TUNNEL:
if (x->outer_mode.family == AF_INET)
return xfrm4_prepare_output(x, skb);
if (x->outer_mode.family == AF_INET6)
return xfrm6_prepare_output... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_output.c |
int xfrm_output_resume(struct sock *sk, struct sk_buff *skb, int err) {
struct net *net = xs_net(skb_dst(skb)->xfrm);
while (likely((err = xfrm_output_one(skb, err)) == 0)) {
nf_reset_ct(skb);
err = skb_dst(skb)->ops->local_out(net, sk, skb);
if (unlikely(err != 1))
goto out;
if (!skb_dst(... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_output.c | static int xfrm6_tunnel_check_size(struct sk_buff *skb) {
int mtu, ret = 0;
struct dst_entry *dst = skb_dst(skb);
if (skb->ignore_df)
goto out;
mtu = dst_mtu(dst);
if (mtu < IPV6_MIN_MTU)
mtu = IPV6_MIN_MTU;
if ((!skb_is_gso(skb) && skb->len > mtu) ||
(skb_is_gso(skb) &&
!skb_gso_val... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_output.c |
static int xfrm_inner_extract_output(struct xfrm_state *x,
struct sk_buff *skb) {
const struct xfrm_mode *inner_mode;
if (x->sel.family == AF_UNSPEC)
inner_mode =
xfrm_ip2inner_mode(x, xfrm_af2proto(skb_dst(skb)->ops->family));
else
inner_mode = &x->inner_mod... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static void xfrm_policy_destroy_rcu(struct rcu_head *head) {
struct xfrm_policy *policy = container_of(head, struct xfrm_policy, rcu);
security_xfrm_policy_free(policy->security);
kfree(policy);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c | void xfrm_policy_destroy(struct xfrm_policy *policy) {
BUG_ON(!policy->walk.dead);
if (del_timer(&policy->timer) || del_timer(&policy->polq.hold_timer))
BUG();
xfrm_dev_policy_free(policy);
call_rcu(&policy->rcu, xfrm_policy_destroy_rcu);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c | static void xfrm_policy_kill(struct xfrm_policy *policy) {
write_lock_bh(&policy->lock);
policy->walk.dead = 1;
write_unlock_bh(&policy->lock);
atomic_inc(&policy->genid);
if (del_timer(&policy->polq.hold_timer))
xfrm_pol_put(policy);
skb_queue_purge(&policy->polq.hold_queue);
if (del_timer(&policy... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static inline unsigned int idx_hash(struct net *net, u32 index) {
return __idx_hash(index, net->xfrm.policy_idx_hmask);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c | static void __get_hash_thresh(struct net *net, unsigned short family, int dir,
u8 *dbits, u8 *sbits) {
switch (family) {
case AF_INET:
*dbits = net->xfrm.policy_bydst[dir].dbits4;
*sbits = net->xfrm.policy_bydst[dir].sbits4;
break;
case AF_INET6:
*dbits = net->xfrm.p... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static struct hlist_head *policy_hash_bysel(struct net *net,
const struct xfrm_selector *sel,
unsigned short family, int dir) {
unsigned int hmask = net->xfrm.policy_bydst[dir].hmask;
unsigned int hash;
u8 dbits;
u8 sbits;
... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static void xfrm_dst_hash_transfer(struct net *net, struct hlist_head *list,
struct hlist_head *ndsttable,
unsigned int nhashmask, int dir) {
struct hlist_node *tmp, *entry0 = NULL;
struct xfrm_policy *pol;
unsigned int h0 = 0;
u8 dbits;
u... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static void xfrm_idx_hash_transfer(struct hlist_head *list,
struct hlist_head *nidxtable,
unsigned int nhashmask) {
struct hlist_node *tmp;
struct xfrm_policy *pol;
hlist_for_each_entry_safe(pol, tmp, list, byidx) {
unsigned int h;
h... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static void xfrm_bydst_resize(struct net *net, int dir) {
unsigned int hmask = net->xfrm.policy_bydst[dir].hmask;
unsigned int nhashmask = xfrm_new_hash_mask(hmask);
unsigned int nsize = (nhashmask + 1) * sizeof(struct hlist_head);
struct hlist_head *ndst = xfrm_hash_alloc(nsize);
struct hlist_head *odst;
... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static inline int xfrm_bydst_should_resize(struct net *net, int dir,
int *total) {
unsigned int cnt = net->xfrm.policy_count[dir];
unsigned int hmask = net->xfrm.policy_bydst[dir].hmask;
if (total)
*total += cnt;
if ((hmask + 1) < xfrm_policy_hashmax && cnt > hm... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c | static void xfrm_hash_resize(struct work_struct *work) {
struct net *net = container_of(work, struct net, xfrm.policy_hash_work);
int dir, total;
mutex_lock(&hash_resize_mutex);
total = 0;
for (dir = 0; dir < XFRM_POLICY_MAX; dir++) {
if (xfrm_bydst_should_resize(net, dir, &total))
xfrm_bydst_resi... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static bool
xfrm_policy_inexact_insert_use_any_list(const struct xfrm_policy *policy) {
const xfrm_address_t *addr;
bool saddr_any, daddr_any;
u8 prefixlen;
addr = &policy->selector.saddr;
prefixlen = policy->selector.prefixlen_s;
saddr_any =
xfrm_pol_inexact_addr_use_any_list(addr, policy->family,... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static struct xfrm_pol_inexact_node *
xfrm_pol_inexact_node_alloc(const xfrm_address_t *addr, u8 prefixlen) {
struct xfrm_pol_inexact_node *node;
node = kzalloc(sizeof(*node), GFP_ATOMIC);
if (node)
xfrm_pol_inexact_node_init(node, addr, prefixlen);
return node;
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static void __xfrm_policy_inexact_flush(struct net *net) {
struct xfrm_pol_inexact_bin *bin, *t;
lockdep_assert_held(&net->xfrm.xfrm_policy_lock);
list_for_each_entry_safe(bin, t, &net->xfrm.inexact_bins, inexact_bins)
__xfrm_policy_inexact_prune_bin(bin, false);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c | static struct hlist_head *
xfrm_policy_inexact_alloc_chain(struct xfrm_pol_inexact_bin *bin,
struct xfrm_policy *policy, u8 dir) {
struct xfrm_pol_inexact_node *n;
struct net *net;
net = xp_net(policy);
lockdep_assert_held(&net->xfrm.xfrm_policy_lock);
if (xfrm_policy_inexact... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
void xfrm_policy_hash_rebuild(struct net *net) {
schedule_work(&net->xfrm.policy_hthresh.work);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static inline int selector_cmp(struct xfrm_selector *s1,
struct xfrm_selector *s2) {
u32 *p1 = (u32 *)s1;
u32 *p2 = (u32 *)s2;
int len = sizeof(struct xfrm_selector) / sizeof(u32);
int i;
for (i = 0; i < len; i++) {
if (p1[i] != p2[i])
return 1;
}
return 0;
} | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static void xfrm_policy_requeue(struct xfrm_policy *old,
struct xfrm_policy *new) {
struct xfrm_policy_queue *pq = &old->polq;
struct sk_buff_head list;
if (skb_queue_empty(&pq->hold_queue))
return;
__skb_queue_head_init(&list);
spin_lock_bh(&pq->hold_queue.lock);
skb... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static u32 xfrm_pol_bin_obj(const void *data, u32 len, u32 seed) {
const struct xfrm_pol_inexact_bin *b = data;
return xfrm_pol_bin_key(&b->k, 0, seed);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c | static inline int xfrm_policy_flush_secctx_check(struct net *net, u8 type,
bool task_valid) {
return 0;
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
int xfrm_dev_policy_flush(struct net *net, struct net_device *dev,
bool task_valid) {
int dir, err = 0, cnt = 0;
struct xfrm_policy *pol;
spin_lock_bh(&net->xfrm.xfrm_policy_lock);
err = xfrm_dev_policy_flush_secctx_check(net, dev, task_valid);
if (err)
goto out;
again:
lis... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk,
int (*func)(struct xfrm_policy *, int, int, void *),
void *data) {
struct xfrm_policy *pol;
struct xfrm_policy_walk_entry *x;
int error = 0;
if (walk->type >= XFRM_POLICY_TYPE_MAX && walk->type != XF... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c | static int xfrm_policy_match(const struct xfrm_policy *pol,
const struct flowi *fl, u8 type, u16 family,
u32 if_id) {
const struct xfrm_selector *sel = &pol->selector;
int ret = -ESRCH;
bool match;
if (pol->family != family || pol->if_id != if_id ||
... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static struct xfrm_pol_inexact_bin *
xfrm_policy_inexact_lookup_rcu(struct net *net, u8 type, u16 family, u8 dir,
u32 if_id) {
struct xfrm_pol_inexact_key k = {
.family = family,
.type = type,
.dir = dir,
.if_id = if_id,
};
write_pnet(&k.net, net);
retur... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static struct xfrm_pol_inexact_bin *
xfrm_policy_inexact_lookup(struct net *net, u8 type, u16 family, u8 dir,
u32 if_id) {
struct xfrm_pol_inexact_bin *bin;
lockdep_assert_held(&net->xfrm.xfrm_policy_lock);
rcu_read_lock();
bin = xfrm_policy_inexact_lookup_rcu(net, type, family, di... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
const struct flowi *fl,
u16 family, u8 dir,
u32 if_id) {
struct xfrm_pol_inexac... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static struct xfrm_policy *xfrm_sk_policy_lookup(const struct sock *sk, int dir,
const struct flowi *fl,
u16 family, u32 if_id) {
struct xfrm_policy *pol;
rcu_read_lock();
again:
pol = rcu_dereference(sk->sk_policy... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c | static struct xfrm_policy *clone_policy(const struct xfrm_policy *old,
int dir) {
struct xfrm_policy *newp = xfrm_policy_alloc(xp_net(old), GFP_ATOMIC);
struct net *net = xp_net(old);
if (newp) {
newp->selector = old->selector;
if (security_xfrm_policy_clone(old->s... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
int __xfrm_sk_clone_policy(struct sock *sk, const struct sock *osk) {
const struct xfrm_policy *p;
struct xfrm_policy *np;
int i, ret = 0;
rcu_read_lock();
for (i = 0; i < 2; i++) {
p = rcu_dereference(osk->sk_policy[i]);
if (p) {
np = clone_policy(p, i);
if (unlikely(!np)) {
ret... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static int xfrm_expand_policies(const struct flowi *fl, u16 family,
struct xfrm_policy **pols, int *num_pols,
int *num_xfrms) {
int i;
if (*num_pols == 0 || !pols[0]) {
*num_pols = 0;
*num_xfrms = 0;
return 0;
}
if (IS_ERR(pols[0])) {... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c | static struct xfrm_dst *
xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols,
const struct flowi *fl, u16 family,
struct dst_entry *dst_orig) {
struct net *net = xp_net(pols[0]);
struct xfrm_state *xfrm[XFRM_MAX_DEPTH];
struct xfrm_d... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static struct dst_entry *make_blackhole(struct net *net, u16 family,
struct dst_entry *dst_orig) {
const struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
struct dst_entry *ret;
if (!afinfo) {
dst_release(dst_orig);
return ERR_PTR(-EINVAL);
} e... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c | struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
const struct flowi *fl, const struct sock *sk,
int flags) {
return xfrm_lookup_with_ifid(net, dst_orig, fl, sk, flags, 0);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c | static inline int xfrm_state_ok(const struct xfrm_tmpl *tmpl,
const struct xfrm_state *x,
unsigned short family) {
if (xfrm_state_kern(x))
return tmpl->optional && !xfrm_state_addr_cmp(tmpl, x, tmpl->encap_family);
return x->id.proto == tmpl->id.pr... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
int __xfrm_decode_session(struct sk_buff *skb, struct flowi *fl,
unsigned int family, int reverse) {
switch (family) {
case AF_INET:
decode_session4(skb, fl, reverse);
break;
#if IS_ENABLED(CONFIG_IPV6)
case AF_INET6:
decode_session6(skb, fl, reverse);
break;
#endif
de... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
int __xfrm_route_forward(struct sk_buff *skb, unsigned short family) {
struct net *net = dev_net(skb->dev);
struct flowi fl;
struct dst_entry *dst;
int res = 1;
if (xfrm_decode_session(skb, &fl, family) < 0) {
XFRM_INC_STATS(net, LINUX_MIB_XFRMFWDHDRERROR);
return 0;
}
skb_dst_force(skb);
if ... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static int stale_bundle(struct dst_entry *dst) {
return !xfrm_bundle_ok((struct xfrm_dst *)dst);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static struct dst_entry *xfrm_negative_advice(struct dst_entry *dst) {
if (dst) {
if (dst->obsolete) {
dst_release(dst);
dst = NULL;
}
}
return dst;
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static void xfrm_init_pmtu(struct xfrm_dst **bundle, int nr) {
while (nr--) {
struct xfrm_dst *xdst = bundle[nr];
u32 pmtu, route_mtu_cached;
struct dst_entry *dst;
dst = &xdst->u.dst;
pmtu = dst_mtu(xfrm_dst_child(dst));
xdst->child_mtu_cached = pmtu;
pmtu = xfrm_state_mtu(dst->xfrm, p... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static unsigned int xfrm_default_advmss(const struct dst_entry *dst) {
return dst_metric_advmss(xfrm_dst_path(dst));
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static unsigned int xfrm_mtu(const struct dst_entry *dst) {
unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
return mtu ?: dst_mtu(xfrm_dst_path(dst));
} | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
void xfrm_if_unregister_cb(void) {
RCU_INIT_POINTER(xfrm_if_cb, NULL);
synchronize_rcu();
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c | static int __net_init xfrm_statistics_init(struct net *net) { return 0; } | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
static void xfrm_statistics_fini(struct net *net) {}
#endif | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c |
void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
bool task_valid) {
struct audit_buffer *audit_buf;
audit_buf = xfrm_audit_start("SPD-delete");
if (audit_buf == NULL)
return;
xfrm_audit_helper_usrinfo(task_valid, audit_buf);
audit_log_format(audit_buf, " re... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c | static bool xfrm_migrate_selector_match(const struct xfrm_selector *sel_cmp,
const struct xfrm_selector *sel_tgt) {
if (sel_cmp->proto == IPSEC_ULPROTO_ANY) {
if (sel_tgt->family == sel_cmp->family &&
xfrm_addr_equal(&sel_tgt->daddr, &sel_cmp->daddr, sel_cmp->family... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_policy.c | static int migrate_tmpl_match(const struct xfrm_migrate *m,
const struct xfrm_tmpl *t) {
int match = 0;
if (t->mode == m->mode && t->id.proto == m->proto &&
(m->reqid == 0 || t->reqid == m->reqid)) {
switch (t->mode) {
case XFRM_MODE_TUNNEL:
case XFRM_MODE_BEET:
... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_replay.c | u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq) {
u32 seq, seq_hi, bottom;
struct xfrm_replay_state_esn *replay_esn = x->replay_esn;
if (!(x->props.flags & XFRM_STATE_ESN))
return 0;
seq = ntohl(net_seq);
seq_hi = replay_esn->seq_hi;
bottom = replay_esn->seq - replay_esn->replay_window + 1... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_replay.c |
void xfrm_replay_advance(struct xfrm_state *x, __be32 net_seq) {
u32 diff, seq;
switch (x->repl_mode) {
case XFRM_REPLAY_MODE_LEGACY:
break;
case XFRM_REPLAY_MODE_BMP:
return xfrm_replay_advance_bmp(x, net_seq);
case XFRM_REPLAY_MODE_ESN:
return xfrm_replay_advance_esn(x, net_seq);
}
if (!x... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_replay.c | static int xfrm_replay_check_esn(struct xfrm_state *x, struct sk_buff *skb,
__be32 net_seq) {
unsigned int bitnr, nr;
u32 diff;
struct xfrm_replay_state_esn *replay_esn = x->replay_esn;
u32 pos;
u32 seq = ntohl(net_seq);
u32 wsize = replay_esn->replay_window;
u32 top = rep... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_replay.c | int xfrm_replay_recheck(struct xfrm_state *x, struct sk_buff *skb,
__be32 net_seq) {
switch (x->repl_mode) {
case XFRM_REPLAY_MODE_LEGACY:
break;
case XFRM_REPLAY_MODE_BMP:
return xfrm_replay_check_bmp(x, skb, net_seq);
case XFRM_REPLAY_MODE_ESN:
return xfrm_replay_recheck_e... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_state.c |
static unsigned long xfrm_hash_new_size(unsigned int state_hmask) {
return ((state_hmask + 1) << 1) * sizeof(struct hlist_head);
} | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_state.c |
int xfrm_register_type(const struct xfrm_type *type, unsigned short family) {
struct xfrm_state_afinfo *afinfo = xfrm_state_get_afinfo(family);
int err = 0;
if (!afinfo)
return -EAFNOSUPPORT;
#define X(afi, T, name) \
do { ... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_state.c |
static void xfrm_put_type(const struct xfrm_type *type) {
module_put(type->owner);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_state.c |
void xfrm_unregister_type_offload(const struct xfrm_type_offload *type,
unsigned short family) {
struct xfrm_state_afinfo *afinfo = xfrm_state_get_afinfo(family);
if (unlikely(afinfo == NULL))
return;
switch (type->proto) {
case IPPROTO_ESP:
WARN_ON(afinfo->type_offl... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_state.c |
void xfrm_state_free(struct xfrm_state *x) {
kmem_cache_free(xfrm_state_cache, x);
} | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_state.c |
static inline int xfrm_dev_state_flush_secctx_check(struct net *net,
struct net_device *dev,
bool task_valid) {
int i, err = 0;
for (i = 0; i <= net->xfrm.state_hmask; i++) {
struct xfrm_state *x;
struc... | [
0,
0
] |
Linux Kernel | net/xfrm/xfrm_state.c |
void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si) {
spin_lock_bh(&net->xfrm.xfrm_state_lock);
si->sadcnt = net->xfrm.state_num;
si->sadhcnt = net->xfrm.state_hmask + 1;
si->sadhmcnt = xfrm_state_hashmax;
spin_unlock_bh(&net->xfrm.xfrm_state_lock);
} | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_state.c |
static void xfrm_init_tempstate(struct xfrm_state *x, const struct flowi *fl,
const struct xfrm_tmpl *tmpl,
const xfrm_address_t *daddr,
const xfrm_address_t *saddr,
unsigned short family) {
... | [
1,
0
] |
Linux Kernel | net/xfrm/xfrm_state.c | static void xfrm_state_look_at(struct xfrm_policy *pol, struct xfrm_state *x,
const struct flowi *fl, unsigned short family,
struct xfrm_state **best, int *acq_in_progress,
int *error) {
if (x->km.state == XFRM_STATE_VALID) ... | [
1,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.