• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Based on include/linux/ipv6.h
4  * No Authors, no Copyright
5  *
6  * Based on include/net/sock.h
7  * Authors:	Ross Biro
8  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
9  *		Corey Minyard <wf-rch!minyard@relay.EU.net>
10  *		Florian La Roche <flla@stud.uni-sb.de>
11  *
12  * Fixes:
13  *		Alan Cox	:	Volatiles in skbuff pointers. See
14  *					skbuff comments. May be overdone,
15  *					better to prove they can be removed
16  *					than the reverse.
17  *		Alan Cox	:	Added a zapped field for tcp to note
18  *					a socket is reset and must stay shut up
19  *		Alan Cox	:	New fields for options
20  *	Pauline Middelink	:	identd support
21  *		Alan Cox	:	Eliminate low level recv/recvfrom
22  *		David S. Miller	:	New socket lookup architecture.
23  *		Steve Whitehouse:	Default routines for sock_ops
24  *		Arnaldo C. Melo :	removed net_pinfo, tp_pinfo and made
25  *					protinfo be just a void pointer, as the
26  *					protocol specific parts were moved to
27  *					respective headers and ipv4/v6, etc now
28  *					use private slabcaches for its socks
29  *		Pedro Hortas	:	New flags field for socket options
30  */
31 #ifndef _NIP_H
32 #define _NIP_H
33 
34 #include <uapi/linux/nip.h>
35 #include <linux/udp.h>
36 #include <linux/tcp.h>
37 #include <linux/spinlock.h>
38 
39 #define ETH_P_NEWIP  0xEADD  /* NIP */
40 
41 /* struct sock_common __sk_common */
42 #define SK_NIP_DADDR     __sk_common.nip_daddr
43 #define SK_NIP_RCV_SADDR __sk_common.nip_rcv_saddr
44 
45 /* struct request_sock req */
46 #define IR_NIP_RMT_ADDR req.__req_common.nip_daddr
47 #define IR_NIP_LOC_ADDR req.__req_common.nip_rcv_saddr
48 
49 struct nip_devconf {
50 	__s32 forwarding;
51 	__s32 mtu;
52 	__s32 ignore_routes_with_linkdown;
53 
54 	__s32 disable_nip;
55 	__s32 nndisc_notify;
56 	__s32 use_oif_addrs_only;
57 	__s32 keep_addr_on_down;
58 
59 	struct ctl_table_header *sysctl_header;
60 };
61 
62 /* This structure contains results of exthdrs parsing
63  * The common CB structure: struct sk_buff->char cb[48]
64  * TCP CB structure       : struct tcp_skb_cb
65  * struct tcp_skb_cb->header is union, include IPv4/IPv6/NewIP xx_skb_parm, max size is 24
66  * sizeof(struct ninet_skb_parm)=19
67  * sizeof(struct inet_skb_parm)=24
68  * sizeof(struct inet6_skb_parm)=20
69  * sizeof(struct tcp_skb_cb->exclude skb_parm)=24 |__ total size is 48, struct sk_buff->char cb[48]
70  * sizeof(struct tcp_skb_cb->include skb_parm)=24 |
71  */
72 #pragma pack(1)
73 struct ninet_skb_parm {
74 	struct nip_addr dstaddr;
75 	struct nip_addr srcaddr;
76 	u8 nexthdr;
77 };
78 #pragma pack()
79 
80 struct tcp_nip_common {
81 	u32 ack_retrans_num;
82 	u32 ack_retrans_seq;
83 	u32 nip_ssthresh;
84 	u32 nip_ssthresh_reset;
85 	bool nip_keepalive_enable;
86 	u32 idle_ka_probes_out;
87 	u32 nip_keepalive_out;
88 	u32 last_rcv_nxt;
89 	u32 dup_ack_cnt;
90 	u32 keepalive_time_bak;
91 	u32 keepalive_probes_bak;
92 	u32 keepalive_intvl_bak;
93 	u32 nip_srtt;
94 	u32 nip_bw;
95 };
96 
97 struct tcp_nip_request_sock {
98 	struct tcp_request_sock tcp_nip_rsk_tcp;
99 	struct tcp_nip_common common;
100 };
101 
102 struct nip_udp_sock {
103 	struct udp_sock udp;
104 };
105 
106 struct tcp_nip_sock {
107 	struct tcp_sock tcp;
108 	struct tcp_nip_common common;
109 };
110 
111 #endif /* _NIP_H */
112