1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/indirect_call_wrapper.h>
7 #include <linux/netdev_features.h>
8 #include <linux/types.h>
11 extern const struct proto_ops inet_stream_ops;
12 extern const struct proto_ops inet_dgram_ops;
15 * INET4 prototypes used by INET6
25 int inet_release(struct socket *sock);
26 int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
27 int addr_len, int flags);
28 int __inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
29 int addr_len, int flags, int is_sendmsg);
30 int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr,
31 int addr_len, int flags);
32 int inet_accept(struct socket *sock, struct socket *newsock, int flags,
34 void __inet_accept(struct socket *sock, struct socket *newsock,
36 int inet_send_prepare(struct sock *sk);
37 int inet_sendmsg(struct socket *sock, struct msghdr *msg, size_t size);
38 void inet_splice_eof(struct socket *sock);
39 int inet_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
41 int inet_shutdown(struct socket *sock, int how);
42 int inet_listen(struct socket *sock, int backlog);
43 int __inet_listen_sk(struct sock *sk, int backlog);
44 void inet_sock_destruct(struct sock *sk);
45 int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
46 int inet_bind_sk(struct sock *sk, struct sockaddr *uaddr, int addr_len);
47 /* Don't allocate port at this moment, defer to connect. */
48 #define BIND_FORCE_ADDRESS_NO_PORT (1 << 0)
49 /* Grab and release socket lock. */
50 #define BIND_WITH_LOCK (1 << 1)
51 /* Called from BPF program. */
52 #define BIND_FROM_BPF (1 << 2)
53 /* Skip CAP_NET_BIND_SERVICE check. */
54 #define BIND_NO_CAP_NET_BIND_SERVICE (1 << 3)
55 int __inet_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
57 int inet_getname(struct socket *sock, struct sockaddr *uaddr,
59 int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
60 int inet_ctl_sock_create(struct sock **sk, unsigned short family,
61 unsigned short type, unsigned char protocol,
63 int inet_recv_error(struct sock *sk, struct msghdr *msg, int len,
66 struct sk_buff *inet_gro_receive(struct list_head *head, struct sk_buff *skb);
67 int inet_gro_complete(struct sk_buff *skb, int nhoff);
68 struct sk_buff *inet_gso_segment(struct sk_buff *skb,
69 netdev_features_t features);
71 static inline void inet_ctl_sock_destroy(struct sock *sk)
74 sock_release(sk->sk_socket);
77 #define indirect_call_gro_receive(f2, f1, cb, head, skb) \
79 unlikely(gro_recursion_inc_test(skb)) ? \
80 NAPI_GRO_CB(skb)->flush |= 1, NULL : \
81 INDIRECT_CALL_2(cb, f2, f1, head, skb); \