Lines Matching refs:pfk

81 static void pfkey_terminate_dump(struct pfkey_sock *pfk)  in pfkey_terminate_dump()  argument
83 if (pfk->dump.dump) { in pfkey_terminate_dump()
84 if (pfk->dump.skb) { in pfkey_terminate_dump()
85 kfree_skb(pfk->dump.skb); in pfkey_terminate_dump()
86 pfk->dump.skb = NULL; in pfkey_terminate_dump()
88 pfk->dump.done(pfk); in pfkey_terminate_dump()
89 pfk->dump.dump = NULL; in pfkey_terminate_dump()
90 pfk->dump.done = NULL; in pfkey_terminate_dump()
143 struct pfkey_sock *pfk; in pfkey_create() local
156 pfk = pfkey_sk(sk); in pfkey_create()
157 mutex_init(&pfk->dump_lock); in pfkey_create()
231 struct pfkey_sock *pfk = pfkey_sk(sk); in pfkey_broadcast() local
238 if (pfk->promisc) in pfkey_broadcast()
248 !pfk->registered) in pfkey_broadcast()
270 static int pfkey_do_dump(struct pfkey_sock *pfk) in pfkey_do_dump() argument
275 mutex_lock(&pfk->dump_lock); in pfkey_do_dump()
276 if (!pfk->dump.dump) { in pfkey_do_dump()
281 rc = pfk->dump.dump(pfk); in pfkey_do_dump()
287 if (pfk->dump.skb) { in pfkey_do_dump()
288 if (!pfkey_can_dump(&pfk->sk)) { in pfkey_do_dump()
293 hdr = (struct sadb_msg *) pfk->dump.skb->data; in pfkey_do_dump()
296 pfkey_broadcast(pfk->dump.skb, GFP_ATOMIC, BROADCAST_ONE, in pfkey_do_dump()
297 &pfk->sk, sock_net(&pfk->sk)); in pfkey_do_dump()
298 pfk->dump.skb = NULL; in pfkey_do_dump()
301 pfkey_terminate_dump(pfk); in pfkey_do_dump()
304 mutex_unlock(&pfk->dump_lock); in pfkey_do_dump()
1687 struct pfkey_sock *pfk = pfkey_sk(sk); in pfkey_register() local
1694 if (pfk->registered&(1<<hdr->sadb_msg_satype)) in pfkey_register()
1696 pfk->registered |= (1<<hdr->sadb_msg_satype); in pfkey_register()
1707 pfk->registered &= ~(1<<hdr->sadb_msg_satype); in pfkey_register()
1788 struct pfkey_sock *pfk = ptr; in dump_sa() local
1792 if (!pfkey_can_dump(&pfk->sk)) in dump_sa()
1800 out_hdr->sadb_msg_version = pfk->dump.msg_version; in dump_sa()
1806 out_hdr->sadb_msg_pid = pfk->dump.msg_portid; in dump_sa()
1808 if (pfk->dump.skb) in dump_sa()
1809 pfkey_broadcast(pfk->dump.skb, GFP_ATOMIC, BROADCAST_ONE, in dump_sa()
1810 &pfk->sk, sock_net(&pfk->sk)); in dump_sa()
1811 pfk->dump.skb = out_skb; in dump_sa()
1816 static int pfkey_dump_sa(struct pfkey_sock *pfk) in pfkey_dump_sa() argument
1818 struct net *net = sock_net(&pfk->sk); in pfkey_dump_sa()
1819 return xfrm_state_walk(net, &pfk->dump.u.state, dump_sa, (void *) pfk); in pfkey_dump_sa()
1822 static void pfkey_dump_sa_done(struct pfkey_sock *pfk) in pfkey_dump_sa_done() argument
1824 struct net *net = sock_net(&pfk->sk); in pfkey_dump_sa_done()
1826 xfrm_state_walk_done(&pfk->dump.u.state, net); in pfkey_dump_sa_done()
1833 struct pfkey_sock *pfk = pfkey_sk(sk); in pfkey_dump() local
1835 mutex_lock(&pfk->dump_lock); in pfkey_dump()
1836 if (pfk->dump.dump != NULL) { in pfkey_dump()
1837 mutex_unlock(&pfk->dump_lock); in pfkey_dump()
1843 mutex_unlock(&pfk->dump_lock); in pfkey_dump()
1854 mutex_unlock(&pfk->dump_lock); in pfkey_dump()
1859 mutex_unlock(&pfk->dump_lock); in pfkey_dump()
1872 pfk->dump.msg_version = hdr->sadb_msg_version; in pfkey_dump()
1873 pfk->dump.msg_portid = hdr->sadb_msg_pid; in pfkey_dump()
1874 pfk->dump.dump = pfkey_dump_sa; in pfkey_dump()
1875 pfk->dump.done = pfkey_dump_sa_done; in pfkey_dump()
1876 xfrm_state_walk_init(&pfk->dump.u.state, proto, filter); in pfkey_dump()
1877 mutex_unlock(&pfk->dump_lock); in pfkey_dump()
1879 return pfkey_do_dump(pfk); in pfkey_dump()
1884 struct pfkey_sock *pfk = pfkey_sk(sk); in pfkey_promisc() local
1892 pfk->promisc = satype; in pfkey_promisc()
2689 struct pfkey_sock *pfk = ptr; in dump_sp() local
2694 if (!pfkey_can_dump(&pfk->sk)) in dump_sp()
2708 out_hdr->sadb_msg_version = pfk->dump.msg_version; in dump_sp()
2713 out_hdr->sadb_msg_pid = pfk->dump.msg_portid; in dump_sp()
2715 if (pfk->dump.skb) in dump_sp()
2716 pfkey_broadcast(pfk->dump.skb, GFP_ATOMIC, BROADCAST_ONE, in dump_sp()
2717 &pfk->sk, sock_net(&pfk->sk)); in dump_sp()
2718 pfk->dump.skb = out_skb; in dump_sp()
2723 static int pfkey_dump_sp(struct pfkey_sock *pfk) in pfkey_dump_sp() argument
2725 struct net *net = sock_net(&pfk->sk); in pfkey_dump_sp()
2726 return xfrm_policy_walk(net, &pfk->dump.u.policy, dump_sp, (void *) pfk); in pfkey_dump_sp()
2729 static void pfkey_dump_sp_done(struct pfkey_sock *pfk) in pfkey_dump_sp_done() argument
2731 struct net *net = sock_net((struct sock *)pfk); in pfkey_dump_sp_done()
2733 xfrm_policy_walk_done(&pfk->dump.u.policy, net); in pfkey_dump_sp_done()
2738 struct pfkey_sock *pfk = pfkey_sk(sk); in pfkey_spddump() local
2740 mutex_lock(&pfk->dump_lock); in pfkey_spddump()
2741 if (pfk->dump.dump != NULL) { in pfkey_spddump()
2742 mutex_unlock(&pfk->dump_lock); in pfkey_spddump()
2746 pfk->dump.msg_version = hdr->sadb_msg_version; in pfkey_spddump()
2747 pfk->dump.msg_portid = hdr->sadb_msg_pid; in pfkey_spddump()
2748 pfk->dump.dump = pfkey_dump_sp; in pfkey_spddump()
2749 pfk->dump.done = pfkey_dump_sp_done; in pfkey_spddump()
2750 xfrm_policy_walk_init(&pfk->dump.u.policy, XFRM_POLICY_TYPE_MAIN); in pfkey_spddump()
2751 mutex_unlock(&pfk->dump_lock); in pfkey_spddump()
2753 return pfkey_do_dump(pfk); in pfkey_spddump()
3713 struct pfkey_sock *pfk = pfkey_sk(sk); in pfkey_recvmsg() local
3740 if (pfk->dump.dump != NULL && in pfkey_recvmsg()
3742 pfkey_do_dump(pfk); in pfkey_recvmsg()