Lines Matching refs:fou
13 #include <net/fou.h>
19 #include <uapi/linux/fou.h>
22 struct fou {
49 static inline struct fou *fou_from_sock(struct sock *sk)
54 static int fou_recv_pull(struct sk_buff *skb, struct fou *fou, size_t len)
59 if (fou->family == AF_INET)
73 struct fou *fou = fou_from_sock(sk);
75 if (!fou)
78 if (fou_recv_pull(skb, fou, sizeof(struct udphdr)))
81 return -fou->protocol;
120 struct fou *fou = fou_from_sock(sk);
127 if (!fou)
156 if (fou_recv_pull(skb, fou, sizeof(struct udphdr)))
180 if (fou->family == AF_INET)
201 !!(fou->flags &
323 struct fou *fou = fou_from_sock(sk);
388 !!(fou->flags &
503 static bool fou_cfg_cmp(struct fou *fou, struct fou_cfg *cfg)
505 struct sock *sk = fou->sock->sk;
508 if (fou->family != udp_cfg->family ||
509 fou->port != udp_cfg->local_udp_port ||
514 if (fou->family == AF_INET) {
533 static int fou_add_to_port_list(struct net *net, struct fou *fou,
537 struct fou *fout;
547 list_add(&fou->list, &fn->fou_list);
553 static void fou_release(struct fou *fou)
555 struct socket *sock = fou->sock;
557 list_del(&fou->list);
560 kfree_rcu(fou, rcu);
567 struct fou *fou = NULL;
578 fou = kzalloc(sizeof(*fou), GFP_KERNEL);
579 if (!fou) {
586 fou->port = cfg->udp_config.local_udp_port;
587 fou->family = cfg->udp_config.family;
588 fou->flags = cfg->flags;
589 fou->type = cfg->type;
590 fou->sock = sock;
594 tunnel_cfg.sk_user_data = fou;
597 /* Initial for fou type */
603 fou->protocol = cfg->protocol;
619 err = fou_add_to_port_list(net, fou, cfg);
629 kfree(fou);
640 struct fou *fou;
643 list_for_each_entry(fou, &fn->fou_list, list) {
644 if (fou_cfg_cmp(fou, cfg)) {
645 fou_release(fou);
788 static int fou_fill_info(struct fou *fou, struct sk_buff *msg)
790 struct sock *sk = fou->sock->sk;
792 if (nla_put_u8(msg, FOU_ATTR_AF, fou->sock->sk->sk_family) ||
793 nla_put_be16(msg, FOU_ATTR_PORT, fou->port) ||
795 nla_put_u8(msg, FOU_ATTR_IPPROTO, fou->protocol) ||
796 nla_put_u8(msg, FOU_ATTR_TYPE, fou->type) ||
800 if (fou->flags & FOU_F_REMCSUM_NOPARTIAL)
804 if (fou->sock->sk->sk_family == AF_INET) {
824 static int fou_dump_info(struct fou *fou, u32 portid, u32 seq,
833 if (fou_fill_info(fou, skb) < 0)
850 struct fou *fout;
895 struct fou *fout;
1212 pr_err("can't add fou ops\n");
1257 struct fou *fou, *next;
1261 list_for_each_entry_safe(fou, next, &fn->fou_list, list)
1262 fou_release(fou);