]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 LT |
2 | #ifndef _INET_COMMON_H |
3 | #define _INET_COMMON_H | |
4 | ||
aaa5d90b PA |
5 | #include <linux/indirect_call_wrapper.h> |
6 | ||
53d3176b CG |
7 | extern const struct proto_ops inet_stream_ops; |
8 | extern const struct proto_ops inet_dgram_ops; | |
1da177e4 LT |
9 | |
10 | /* | |
11 | * INET4 prototypes used by INET6 | |
12 | */ | |
13 | ||
77d8bf9c ACM |
14 | struct msghdr; |
15 | struct sock; | |
16 | struct sockaddr; | |
17 | struct socket; | |
18 | ||
1fd51155 JP |
19 | int inet_release(struct socket *sock); |
20 | int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, | |
21 | int addr_len, int flags); | |
22 | int __inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, | |
3979ad7e | 23 | int addr_len, int flags, int is_sendmsg); |
1fd51155 JP |
24 | int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr, |
25 | int addr_len, int flags); | |
cdfbabfb DH |
26 | int inet_accept(struct socket *sock, struct socket *newsock, int flags, |
27 | bool kern); | |
e4730936 | 28 | int inet_send_prepare(struct sock *sk); |
1b784140 | 29 | int inet_sendmsg(struct socket *sock, struct msghdr *msg, size_t size); |
1fd51155 JP |
30 | ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset, |
31 | size_t size, int flags); | |
1b784140 YX |
32 | int inet_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, |
33 | int flags); | |
1fd51155 JP |
34 | int inet_shutdown(struct socket *sock, int how); |
35 | int inet_listen(struct socket *sock, int backlog); | |
36 | void inet_sock_destruct(struct sock *sk); | |
37 | int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len); | |
cb0721c7 SF |
38 | /* Don't allocate port at this moment, defer to connect. */ |
39 | #define BIND_FORCE_ADDRESS_NO_PORT (1 << 0) | |
40 | /* Grab and release socket lock. */ | |
41 | #define BIND_WITH_LOCK (1 << 1) | |
8086fbaf SF |
42 | /* Called from BPF program. */ |
43 | #define BIND_FROM_BPF (1 << 2) | |
77241217 SF |
44 | /* Skip CAP_NET_BIND_SERVICE check. */ |
45 | #define BIND_NO_CAP_NET_BIND_SERVICE (1 << 3) | |
3679d585 | 46 | int __inet_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len, |
cb0721c7 | 47 | u32 flags); |
9b2c45d4 | 48 | int inet_getname(struct socket *sock, struct sockaddr *uaddr, |
1fd51155 JP |
49 | int peer); |
50 | int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); | |
51 | int inet_ctl_sock_create(struct sock **sk, unsigned short family, | |
52 | unsigned short type, unsigned char protocol, | |
53 | struct net *net); | |
f4713a3d WB |
54 | int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, |
55 | int *addr_len); | |
5677242f | 56 | |
d4546c25 | 57 | struct sk_buff *inet_gro_receive(struct list_head *head, struct sk_buff *skb); |
b8921ca8 TH |
58 | int inet_gro_complete(struct sk_buff *skb, int nhoff); |
59 | struct sk_buff *inet_gso_segment(struct sk_buff *skb, | |
60 | netdev_features_t features); | |
61 | ||
5677242f DL |
62 | static inline void inet_ctl_sock_destroy(struct sock *sk) |
63 | { | |
8fa677d2 ED |
64 | if (sk) |
65 | sock_release(sk->sk_socket); | |
5677242f | 66 | } |
3d58b5fa | 67 | |
028e0a47 PA |
68 | #define indirect_call_gro_receive(f2, f1, cb, head, skb) \ |
69 | ({ \ | |
70 | unlikely(gro_recursion_inc_test(skb)) ? \ | |
71 | NAPI_GRO_CB(skb)->flush |= 1, NULL : \ | |
72 | INDIRECT_CALL_2(cb, f2, f1, head, skb); \ | |
73 | }) | |
74 | ||
1da177e4 | 75 | #endif |