summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_var.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/ip_var.h')
-rw-r--r--sys/netinet/ip_var.h76
1 files changed, 38 insertions, 38 deletions
diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h
index 58707e805e0..c78365d93f8 100644
--- a/sys/netinet/ip_var.h
+++ b/sys/netinet/ip_var.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_var.h,v 1.14 1995/06/12 00:47:47 mycroft Exp $ */
+/* $NetBSD: ip_var.h,v 1.15 1995/11/21 01:07:38 cgd Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@@ -35,12 +35,13 @@
* @(#)ip_var.h 8.1 (Berkeley) 6/10/93
*/
+#include <sys/queue.h>
+
/*
* Overlay for ip header used by other protocols (tcp, udp).
*/
struct ipovly {
- caddr_t ih_next, ih_prev; /* for protocol sequence q's */
- u_int8_t ih_x1; /* (unused) */
+ u_int8_t ih_x1[9]; /* (unused) */
u_int8_t ih_pr; /* protocol */
int16_t ih_len; /* protocol length */
struct in_addr ih_src; /* source internet address */
@@ -48,49 +49,49 @@ struct ipovly {
};
/*
+ * Ip (reassembly or sequence) queue structures.
+ *
+ * XXX -- The following explains why the ipqe_m field is here, for TCP's use:
+ * We want to avoid doing m_pullup on incoming packets but that
+ * means avoiding dtom on the tcp reassembly code. That in turn means
+ * keeping an mbuf pointer in the reassembly queue (since we might
+ * have a cluster). As a quick hack, the source & destination
+ * port numbers (which are no longer needed once we've located the
+ * tcpcb) are overlayed with an mbuf pointer.
+ */
+LIST_HEAD(ipqehead, ipqent);
+struct ipqent {
+ LIST_ENTRY(ipqent) ipqe_q;
+ union {
+ struct ip *_ip;
+ struct tcpiphdr *_tcp;
+ } _ipqe_u1;
+ union {
+ u_int8_t _mff; /* for IP fragmentation */
+ struct mbuf *_m; /* XXX for TCP; see above */
+ } _ipqe_u2;
+};
+#define ipqe_ip _ipqe_u1._ip
+#define ipqe_tcp _ipqe_u1._tcp
+#define ipqe_mff _ipqe_u2._mff
+#define ipqe_m _ipqe_u2._m
+
+/*
* Ip reassembly queue structure. Each fragment
* being reassembled is attached to one of these structures.
* They are timed out after ipq_ttl drops to 0, and may also
* be reclaimed if memory becomes tight.
*/
struct ipq {
- struct ipq *next, *prev; /* to other reass headers */
+ LIST_ENTRY(ipq) ipq_q; /* to other reass headers */
u_int8_t ipq_ttl; /* time for reass q to live */
u_int8_t ipq_p; /* protocol of this fragment */
u_int16_t ipq_id; /* sequence id for reassembly */
- struct ipasfrag *ipq_next, *ipq_prev;
- /* to ip headers of fragments */
+ struct ipqehead ipq_fragq; /* to ip fragment queue */
struct in_addr ipq_src, ipq_dst;
};
/*
- * Ip header, when holding a fragment.
- *
- * Note: ipf_next must be at same offset as ipq_next above
- */
-struct ipasfrag {
-#if BYTE_ORDER == LITTLE_ENDIAN
- u_int8_t ip_hl:4,
- ip_v:4;
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t ip_v:4,
- ip_hl:4;
-#endif
- u_int8_t ipf_mff; /* XXX overlays ip_tos: use low bit
- * to avoid destroying tos;
- * copied from (ip_off&IP_MF) */
- int16_t ip_len;
- u_int16_t ip_id;
- int16_t ip_off;
- u_int8_t ip_ttl;
- u_int8_t ip_p;
- u_int16_t ip_sum;
- struct ipasfrag *ipf_next, *ipf_prev;
- /* list of fragments */
-};
-
-/*
* Structure stored in mbuf in inpcb.ip_options
* and passed to ip_output when ip options are in use.
* The actual length of the options (including ipopt_dst)
@@ -141,6 +142,7 @@ struct ipstat {
u_long ips_badvers; /* ip version != 4 */
u_long ips_rawout; /* total raw ip packets generated */
u_long ips_badfrags; /* malformed fragments (bad length) */
+ u_long ips_rcvmemdrop; /* frags dropped for lack of memory */
};
#ifdef _KERNEL
@@ -151,15 +153,13 @@ struct ipstat {
#define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */
struct ipstat ipstat;
-struct ipq ipq; /* ip reass. queue */
-u_int16_t ip_id; /* ip packet ctr, for ids */
+LIST_HEAD(ipqhead, ipq) ipq; /* ip reass. queue */
+u_int16_t ip_id; /* ip packet ctr, for ids */
int ip_defttl; /* default IP ttl */
int ip_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
-void ip_deq __P((struct ipasfrag *));
int ip_dooptions __P((struct mbuf *));
void ip_drain __P((void));
-void ip_enq __P((struct ipasfrag *, struct ipasfrag *));
void ip_forward __P((struct mbuf *, int));
void ip_freef __P((struct ipq *));
void ip_freemoptions __P((struct ip_moptions *));
@@ -171,7 +171,7 @@ int ip_output __P((struct mbuf *,
struct mbuf *, struct route *, int, struct ip_moptions *));
int ip_pcbopts __P((struct mbuf **, struct mbuf *));
struct ip *
- ip_reass __P((struct ipasfrag *, struct ipq *));
+ ip_reass __P((struct ipqent *, struct ipq *));
struct in_ifaddr *
ip_rtaddr __P((struct in_addr));
int ip_setmoptions __P((int, struct ip_moptions **, struct mbuf *));