summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorshin <shin@FreeBSD.org>1999-11-05 14:41:39 +0000
committershin <shin@FreeBSD.org>1999-11-05 14:41:39 +0000
commit7efc91cadcfeb421fc4d02ba94db784616f3714c (patch)
treef40f3ca5e5c27dfec6f4c10b00aa3b391491a550 /sys/netinet
parent660a7daead2ffcf4f7e3d2a3c874a82ccc8954c8 (diff)
downloadFreeBSD-src-7efc91cadcfeb421fc4d02ba94db784616f3714c.zip
FreeBSD-src-7efc91cadcfeb421fc4d02ba94db784616f3714c.tar.gz
KAME related header files additions and merges.
(only those which don't affect c source files so much) Reviewed by: cvs-committers Obtained from: KAME project
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/if_ether.h16
-rw-r--r--sys/netinet/in.h54
-rw-r--r--sys/netinet/in_pcb.c3
-rw-r--r--sys/netinet/in_pcb.h1
-rw-r--r--sys/netinet/in_var.h3
-rw-r--r--sys/netinet/ip_var.h1
-rw-r--r--sys/netinet/tcp.h8
-rw-r--r--sys/netinet/tcp_fsm.h16
-rw-r--r--sys/netinet/tcp_subr.c6
-rw-r--r--sys/netinet/tcp_timewait.c6
-rw-r--r--sys/netinet/tcp_var.h5
-rw-r--r--sys/netinet/udp_usrreq.c19
-rw-r--r--sys/netinet/udp_var.h17
13 files changed, 120 insertions, 35 deletions
diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h
index 79f1252..09caa31 100644
--- a/sys/netinet/if_ether.h
+++ b/sys/netinet/if_ether.h
@@ -56,6 +56,22 @@
(enaddr)[4] = ((u_char *)ipaddr)[2]; \
(enaddr)[5] = ((u_char *)ipaddr)[3]; \
}
+/*
+ * Macro to map an IP6 multicast address to an Ethernet multicast address.
+ * The high-order 16 bits of the Ethernet address are statically assigned,
+ * and the low-order 32 bits are taken from the low end of the IP6 address.
+ */
+#define ETHER_MAP_IPV6_MULTICAST(ip6addr, enaddr) \
+/* struct in6_addr *ip6addr; */ \
+/* u_char enaddr[ETHER_ADDR_LEN]; */ \
+{ \
+ (enaddr)[0] = 0x33; \
+ (enaddr)[1] = 0x33; \
+ (enaddr)[2] = ((u_char *)ip6addr)[12]; \
+ (enaddr)[3] = ((u_char *)ip6addr)[13]; \
+ (enaddr)[4] = ((u_char *)ip6addr)[14]; \
+ (enaddr)[5] = ((u_char *)ip6addr)[15]; \
+}
/*
* Ethernet Address Resolution Protocol.
diff --git a/sys/netinet/in.h b/sys/netinet/in.h
index ba5d24f..9e8a652 100644
--- a/sys/netinet/in.h
+++ b/sys/netinet/in.h
@@ -46,10 +46,12 @@
* Protocols (RFC 1700)
*/
#define IPPROTO_IP 0 /* dummy for IP */
+#define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */
#define IPPROTO_ICMP 1 /* control message protocol */
#define IPPROTO_IGMP 2 /* group mgmt protocol */
#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
-#define IPPROTO_IPIP 4 /* IP encapsulation in IP */
+#define IPPROTO_IPV4 4 /* IPv4 encapsulation */
+#define IPPROTO_IPIP IPPROTO_IPV4 /* for compatibility */
#define IPPROTO_TCP 6 /* tcp */
#define IPPROTO_ST 7 /* Stream protocol II */
#define IPPROTO_EGP 8 /* exterior gateway protocol */
@@ -85,21 +87,24 @@
#define IPPROTO_CMTP 38 /* Control Message Transport */
#define IPPROTO_TPXX 39 /* TP++ Transport */
#define IPPROTO_IL 40 /* IL transport protocol */
-#define IPPROTO_SIP 41 /* Simple Internet Protocol */
+#define IPPROTO_IPV6 41 /* IP6 header */
#define IPPROTO_SDRP 42 /* Source Demand Routing */
-#define IPPROTO_SIPSR 43 /* SIP Source Route */
-#define IPPROTO_SIPFRAG 44 /* SIP Fragment */
+#define IPPROTO_ROUTING 43 /* IP6 routing header */
+#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */
#define IPPROTO_IDRP 45 /* InterDomain Routing*/
-#define IPPROTO_RSVP 46 /* resource reservation */
+#define IPPROTO_RSVP 46 /* resource reservation */
#define IPPROTO_GRE 47 /* General Routing Encap. */
#define IPPROTO_MHRP 48 /* Mobile Host Routing */
#define IPPROTO_BHA 49 /* BHA */
-#define IPPROTO_ESP 50 /* SIPP Encap Sec. Payload */
-#define IPPROTO_AH 51 /* SIPP Auth Header */
+#define IPPROTO_ESP 50 /* IP6 Encap Sec. Payload */
+#define IPPROTO_AH 51 /* IP6 Auth Header */
#define IPPROTO_INLSP 52 /* Integ. Net Layer Security */
#define IPPROTO_SWIPE 53 /* IP with encryption */
#define IPPROTO_NHRP 54 /* Next Hop Resolution */
-/* 55-60: Unassigned */
+/* 55-57: Unassigned */
+#define IPPROTO_ICMPV6 58 /* ICMP6 */
+#define IPPROTO_NONE 59 /* IP6 no next header */
+#define IPPROTO_DSTOPTS 60 /* IP6 destination option */
#define IPPROTO_AHIP 61 /* any host internal protocol */
#define IPPROTO_CFTP 62 /* CFTP */
#define IPPROTO_HELLO 63 /* "hello" routing protocol */
@@ -140,7 +145,9 @@
#define IPPROTO_ENCAP 98 /* encapsulation header */
#define IPPROTO_APES 99 /* any private encr. scheme */
#define IPPROTO_GMTP 100 /* GMTP*/
+#define IPPROTO_IPCOMP 108 /* payload compression (IPComp) */
/* 101-254: Partly Unassigned */
+#define IPPROTO_PIM 103 /* Protocol Independent Mcast */
#define IPPROTO_PGM 113 /* PGM */
/* 255: Reserved */
/* BSD Private, local use, namespace incursion */
@@ -148,6 +155,8 @@
#define IPPROTO_RAW 255 /* raw IP packet */
#define IPPROTO_MAX 256
+/* last return value of *_input(), meaning "all job for this pkt is done". */
+#define IPPROTO_DONE 257
/*
* Local port number conventions:
@@ -280,6 +289,8 @@ struct sockaddr_in {
char sin_zero[8];
};
+#define INET_ADDRSTRLEN 16
+
/*
* Structure used to describe IP options.
* Used to store options internally, to pass them to a process,
@@ -316,13 +327,16 @@ struct ip_opts {
#define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */
#define IP_PORTRANGE 19 /* int; range to choose for unspec port */
#define IP_RECVIF 20 /* bool; receive reception if w/dgram */
+/* for IPSEC */
+#define IP_IPSEC_POLICY 21 /* int; set/get security policy */
+#define IP_FAITH 22 /* bool; accept FAITH'ed connections */
-#define IP_FW_ADD 50 /* add a firewall rule to chain */
-#define IP_FW_DEL 51 /* delete a firewall rule from chain */
-#define IP_FW_FLUSH 52 /* flush firewall rule chain */
-#define IP_FW_ZERO 53 /* clear single/all firewall counter(s) */
-#define IP_FW_GET 54 /* get entire firewall rule chain */
-#define IP_FW_RESETLOG 55 /* reset logging counters */
+#define IP_FW_ADD 50 /* add a firewall rule to chain */
+#define IP_FW_DEL 51 /* delete a firewall rule from chain */
+#define IP_FW_FLUSH 52 /* flush firewall rule chain */
+#define IP_FW_ZERO 53 /* clear single/all firewall counter(s) */
+#define IP_FW_GET 54 /* get entire firewall rule chain */
+#define IP_FW_RESETLOG 55 /* reset logging counters */
#define IP_DUMMYNET_CONFIGURE 60 /* add/configure a dummynet pipe */
#define IP_DUMMYNET_DEL 61 /* delete a dummynet pipe from chain */
@@ -358,7 +372,7 @@ struct ip_mreq {
* Third level is protocol number.
* Fourth level is desired variable within that protocol.
*/
-#define IPPROTO_MAXID (IPPROTO_IDP + 1) /* don't list to IPPROTO_MAX */
+#define IPPROTO_MAXID (IPPROTO_ESP + 1) /* don't list to IPPROTO_MAX */
#define CTL_IPPROTO_NAMES { \
{ "ip", CTLTYPE_NODE }, \
@@ -401,11 +415,13 @@ struct ip_mreq {
#define IPCTL_SOURCEROUTE 8 /* may perform source routes */
#define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */
#define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */
-#define IPCTL_INTRQDROPS 11 /* number of netisr q drops */
+#define IPCTL_INTRQDROPS 11 /* number of netisr q drops */
#define IPCTL_STATS 12 /* ipstat structure */
#define IPCTL_ACCEPTSOURCEROUTE 13 /* may accept source routed packets */
-#define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */
-#define IPCTL_MAXID 15
+#define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */
+#define IPCTL_KEEPFAITH 15
+#define IPCTL_GIF_TTL 16 /* default TTL for gif encap packet */
+#define IPCTL_MAXID 17
#define IPCTL_NAMES { \
{ 0, 0 }, \
@@ -425,6 +441,8 @@ struct ip_mreq {
{ "fastforwarding", CTLTYPE_INT }, \
}
+/* INET6 stuff */
+#include <netinet6/in6.h>
#ifdef KERNEL
struct ifnet; struct mbuf; /* forward declarations for Standard C */
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 018a040..fdba717 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -60,7 +60,6 @@
struct in_addr zeroin_addr;
-static void in_pcbremlists __P((struct inpcb *));
static void in_rtchange __P((struct inpcb *, int));
/*
@@ -889,7 +888,7 @@ in_pcbrehash(inp)
/*
* Remove PCB from various lists.
*/
-static void
+void
in_pcbremlists(inp)
struct inpcb *inp;
{
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index 0912fea..c891207 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -168,6 +168,7 @@ void in_pcbnotify __P((struct inpcbhead *, struct sockaddr *,
void in_pcbrehash __P((struct inpcb *));
int in_setpeeraddr __P((struct socket *so, struct sockaddr **nam));
int in_setsockaddr __P((struct socket *so, struct sockaddr **nam));
+void in_pcbremlists __P((struct inpcb *inp));
int prison_xinpcb __P((struct proc *p, struct inpcb *inp));
#endif /* KERNEL */
diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h
index 9569f48..c04c778 100644
--- a/sys/netinet/in_var.h
+++ b/sys/netinet/in_var.h
@@ -232,4 +232,7 @@ void ipflow_slowtimo __P((void));
#endif /* KERNEL */
+/* INET6 stuff */
+#include <netinet6/in6_var.h>
+
#endif /* _NETINET_IN_VAR_H_ */
diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h
index 08b3a06..1b69ec2 100644
--- a/sys/netinet/ip_var.h
+++ b/sys/netinet/ip_var.h
@@ -121,6 +121,7 @@ struct ipstat {
u_long ips_rawout; /* total raw ip packets generated */
u_long ips_toolong; /* ip length > max ip packet size */
u_long ips_notmember; /* multicasts for unregistered grps */
+ u_long ips_nogif; /* no match gif found */
};
#ifdef KERNEL
diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h
index 268b54e..436f23a 100644
--- a/sys/netinet/tcp.h
+++ b/sys/netinet/tcp.h
@@ -102,6 +102,14 @@ struct tcphdr {
*/
#define TCP_MSS 512
+/*
+ * Default maximum segment size for TCP6.
+ * With an IP6 MSS of 1280, this is 1220,
+ * but 1024 is probably more convenient. (xxx kazu in doubt)
+ * This should be defined as MIN(1024, IP6_MSS - sizeof (struct tcpip6hdr))
+ */
+#define TCP6_MSS 1024
+
#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */
#define TTCP_CLIENT_SND_WND 4096 /* dflt send window for T/TCP client */
diff --git a/sys/netinet/tcp_fsm.h b/sys/netinet/tcp_fsm.h
index 2af6e2b..eb9a909 100644
--- a/sys/netinet/tcp_fsm.h
+++ b/sys/netinet/tcp_fsm.h
@@ -59,8 +59,22 @@
#define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */
#define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */
+/* for KAME src sync over BSD*'s */
+#define TCP6_NSTATES TCP_NSTATES
+#define TCP6S_CLOSED TCPS_CLOSED
+#define TCP6S_LISTEN TCPS_LISTEN
+#define TCP6S_SYN_SENT TCPS_SYN_SENT
+#define TCP6S_SYN_RECEIVED TCPS_SYN_RECEIVED
+#define TCP6S_ESTABLISHED TCPS_ESTABLISHED
+#define TCP6S_CLOSE_WAIT TCPS_CLOSE_WAIT
+#define TCP6S_FIN_WAIT_1 TCPS_FIN_WAIT_1
+#define TCP6S_CLOSING TCPS_CLOSING
+#define TCP6S_LAST_ACK TCPS_LAST_ACK
+#define TCP6S_FIN_WAIT_2 TCPS_FIN_WAIT_2
+#define TCP6S_TIME_WAIT TCPS_TIME_WAIT
+
#define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED)
-#define TCPS_HAVEESTABLISHED(s) ((s) >= TCPS_ESTABLISHED)
+#define TCPS_HAVEESTABLISHED(s) ((s) >= TCPS_ESTABLISHED)
#define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT)
#ifdef TCPOUTFLAGS
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 07da954..68c69b0 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -75,6 +75,12 @@ int tcp_mssdflt = TCP_MSS;
SYSCTL_INT(_net_inet_tcp, TCPCTL_MSSDFLT, mssdflt, CTLFLAG_RW,
&tcp_mssdflt , 0, "Default TCP Maximum Segment Size");
+#ifdef INET6
+int tcp_v6mssdflt = TCP6_MSS;
+SYSCTL_INT(_net_inet_tcp, TCPCTL_V6MSSDFLT, v6mssdflt,
+ CTLFLAG_RW, &tcp_v6mssdflt , 0, "");
+#endif
+
#if 0
static int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ;
SYSCTL_INT(_net_inet_tcp, TCPCTL_RTTDFLT, rttdflt, CTLFLAG_RW,
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index 07da954..68c69b0 100644
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -75,6 +75,12 @@ int tcp_mssdflt = TCP_MSS;
SYSCTL_INT(_net_inet_tcp, TCPCTL_MSSDFLT, mssdflt, CTLFLAG_RW,
&tcp_mssdflt , 0, "Default TCP Maximum Segment Size");
+#ifdef INET6
+int tcp_v6mssdflt = TCP6_MSS;
+SYSCTL_INT(_net_inet_tcp, TCPCTL_V6MSSDFLT, v6mssdflt,
+ CTLFLAG_RW, &tcp_v6mssdflt , 0, "");
+#endif
+
#if 0
static int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ;
SYSCTL_INT(_net_inet_tcp, TCPCTL_RTTDFLT, rttdflt, CTLFLAG_RW,
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 8d7c597..0258b77 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -252,6 +252,7 @@ struct tcpstat {
u_long tcps_rcvbyte; /* bytes received in sequence */
u_long tcps_rcvbadsum; /* packets received with ccksum errs */
u_long tcps_rcvbadoff; /* packets received with bad offset */
+ u_long tcps_rcvmemdrop; /* packets dropped for lack of memory */
u_long tcps_rcvshort; /* packets received too short */
u_long tcps_rcvduppack; /* duplicate-only packets received */
u_long tcps_rcvdupbyte; /* duplicate-only bytes received */
@@ -314,7 +315,8 @@ struct xtcpcb {
#define TCPCTL_KEEPINIT 10 /* receive buffer space */
#define TCPCTL_PCBLIST 11 /* list of all outstanding PCBs */
#define TCPCTL_DELACKTIME 12 /* time before sending delayed ACK */
-#define TCPCTL_MAXID 13
+#define TCPCTL_V6MSSDFLT 13 /* MSS default for IPv6 */
+#define TCPCTL_MAXID 14
#define TCPCTL_NAMES { \
{ 0, 0 }, \
@@ -330,6 +332,7 @@ struct xtcpcb {
{ "keepinit", CTLTYPE_INT }, \
{ "pcblist", CTLTYPE_STRUCT }, \
{ "delacktime", CTLTYPE_INT }, \
+ { "v6mssdflt", CTLTYPE_INT }, \
}
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 44ff6ee..b47b0be 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -74,22 +74,22 @@ static int udpcksum = 0; /* XXX */
SYSCTL_INT(_net_inet_udp, UDPCTL_CHECKSUM, checksum, CTLFLAG_RW,
&udpcksum, 0, "");
-static int log_in_vain = 0;
+int log_in_vain = 0;
SYSCTL_INT(_net_inet_udp, OID_AUTO, log_in_vain, CTLFLAG_RW,
&log_in_vain, 0, "Log all incoming UDP packets");
-static int blackhole = 0;
+static int blackhole = 0;
SYSCTL_INT(_net_inet_udp, OID_AUTO, blackhole, CTLFLAG_RW,
&blackhole, 0, "Do not send port unreachables for refused connects");
-static struct inpcbhead udb; /* from udp_var.h */
-struct inpcbinfo udbinfo;
+struct inpcbhead udb; /* from udp_var.h */
+struct inpcbinfo udbinfo;
#ifndef UDBHASHSIZE
#define UDBHASHSIZE 16
#endif
-static struct udpstat udpstat; /* from udp_var.h */
+struct udpstat udpstat; /* from udp_var.h */
SYSCTL_STRUCT(_net_inet_udp, UDPCTL_STATS, stats, CTLFLAG_RD,
&udpstat, udpstat, "UDP statistics (struct udpstat, netinet/udp_var.h)");
@@ -97,7 +97,6 @@ static struct sockaddr_in udp_in = { sizeof(udp_in), AF_INET };
static int udp_output __P((struct inpcb *, struct mbuf *, struct sockaddr *,
struct mbuf *, struct proc *));
-static void udp_notify __P((struct inpcb *, int));
void
udp_init()
@@ -341,7 +340,7 @@ bad:
* Notify a udp user of an asynchronous error;
* just wake up so that he can collect error status.
*/
-static void
+void
udp_notify(inp, errno)
register struct inpcb *inp;
int errno;
@@ -585,12 +584,12 @@ release:
return (error);
}
-static u_long udp_sendspace = 9216; /* really max datagram size */
+u_long udp_sendspace = 9216; /* really max datagram size */
/* 40 1K datagrams */
SYSCTL_INT(_net_inet_udp, UDPCTL_MAXDGRAM, maxdgram, CTLFLAG_RW,
&udp_sendspace, 0, "Maximum outgoing UDP datagram size");
-static u_long udp_recvspace = 40 * (1024 + sizeof(struct sockaddr_in));
+u_long udp_recvspace = 40 * (1024 + sizeof(struct sockaddr_in));
SYSCTL_INT(_net_inet_udp, UDPCTL_RECVSPACE, recvspace, CTLFLAG_RW,
&udp_recvspace, 0, "Maximum incoming UDP datagram size");
@@ -718,7 +717,7 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
return udp_output(inp, m, addr, control, p);
}
-static int
+int
udp_shutdown(struct socket *so)
{
struct inpcb *inp;
diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h
index 5ede8a6..0ee8258 100644
--- a/sys/netinet/udp_var.h
+++ b/sys/netinet/udp_var.h
@@ -69,6 +69,7 @@ struct udpstat {
u_long udps_ipackets; /* total input packets */
u_long udps_hdrops; /* packet shorter than header */
u_long udps_badsum; /* checksum error */
+ u_long udps_nosum; /* no checksum */
u_long udps_badlen; /* data length larger than packet */
u_long udps_noport; /* no socket on port */
u_long udps_noportbcast; /* of above, arrived as broadcast */
@@ -78,6 +79,8 @@ struct udpstat {
/* output statistics: */
u_long udps_opackets; /* total output packets */
u_long udps_fastout; /* output packets on fast path */
+ /* of no socket on port, arrived as multicast */
+ u_long udps_noportmcast;
};
/*
@@ -103,11 +106,19 @@ struct udpstat {
SYSCTL_DECL(_net_inet_udp);
extern struct pr_usrreqs udp_usrreqs;
+extern struct inpcbhead udb;
extern struct inpcbinfo udbinfo;
+extern u_long udp_sendspace;
+extern u_long udp_recvspace;
+extern struct udpstat udpstat;
+extern int log_in_vain;
-void udp_ctlinput __P((int, struct sockaddr *, void *));
-void udp_init __P((void));
-void udp_input __P((struct mbuf *, int));
+void udp_ctlinput __P((int, struct sockaddr *, void *));
+void udp_init __P((void));
+void udp_input __P((struct mbuf *, int));
+
+void udp_notify __P((struct inpcb *inp, int errno));
+int udp_shutdown __P((struct socket *so));
#endif
#endif
OpenPOWER on IntegriCloud