summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2013-03-29 13:16:15 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2013-03-29 13:16:15 +0000
commit4689d80b9a3dac1595ad5514461cd7a3147f9f9b (patch)
tree13fd6111dffcea4b711df185d2c74a7ef56a383f /sys
parent479167afe8afba5cc139b3e52d350f7e4cfb70e9 (diff)
Declare struct pf_state_key in the mbuf and in_pcb header files to
avoid ugly casts. OK krw@ tedu@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/pf.c9
-rw-r--r--sys/netinet/in_pcb.c4
-rw-r--r--sys/netinet/in_pcb.h6
-rw-r--r--sys/netinet/ip_input.c4
-rw-r--r--sys/netinet/tcp_input.c9
-rw-r--r--sys/netinet/udp_usrreq.c7
-rw-r--r--sys/sys/mbuf.h6
7 files changed, 23 insertions, 22 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index d4f9471db97..c8baaf09b9a 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.820 2013/03/28 00:32:11 bluhm Exp $ */
+/* $OpenBSD: pf.c,v 1.821 2013/03/29 13:16:14 bluhm Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1018,8 +1018,8 @@ pf_find_state(struct pfi_kif *kif, struct pf_state_key_cmp *key, u_int dir,
}
if (dir == PF_OUT && m->m_pkthdr.pf.statekey &&
- ((struct pf_state_key *)m->m_pkthdr.pf.statekey)->reverse)
- sk = ((struct pf_state_key *)m->m_pkthdr.pf.statekey)->reverse;
+ m->m_pkthdr.pf.statekey->reverse)
+ sk = m->m_pkthdr.pf.statekey->reverse;
else {
if ((sk = RB_FIND(pf_state_tree, &pf_statetbl,
(struct pf_state_key *)key)) == NULL)
@@ -1027,8 +1027,7 @@ pf_find_state(struct pfi_kif *kif, struct pf_state_key_cmp *key, u_int dir,
if (dir == PF_OUT && m->m_pkthdr.pf.statekey &&
pf_compare_state_keys(m->m_pkthdr.pf.statekey, sk,
kif, dir) == 0) {
- ((struct pf_state_key *)
- m->m_pkthdr.pf.statekey)->reverse = sk;
+ m->m_pkthdr.pf.statekey->reverse = sk;
sk->reverse = m->m_pkthdr.pf.statekey;
}
}
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index b0882f574bb..cf64629aaf5 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.133 2013/03/28 12:06:55 mpi Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.134 2013/03/29 13:16:14 bluhm Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -500,7 +500,7 @@ in_pcbdetach(struct inpcb *inp)
#endif
#if NPF > 0
if (inp->inp_pf_sk)
- ((struct pf_state_key *)inp->inp_pf_sk)->inp = NULL;
+ inp->inp_pf_sk->inp = NULL;
#endif
s = splnet();
LIST_REMOVE(inp, inp_lhash);
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index f5e75369970..e47636e7121 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.h,v 1.76 2013/03/14 11:18:37 mpi Exp $ */
+/* $OpenBSD: in_pcb.h,v 1.77 2013/03/29 13:16:14 bluhm Exp $ */
/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
/*
@@ -70,6 +70,8 @@
#include <netinet/icmp6.h>
#include <netinet/ip_ipsp.h>
+struct pf_state_key;
+
union inpaddru {
struct in6_addr iau_addr6;
struct {
@@ -145,7 +147,7 @@ struct inpcb {
#define inp_csumoffset in6p_cksum
#endif
struct icmp6_filter *inp_icmp6filt;
- void *inp_pf_sk;
+ struct pf_state_key *inp_pf_sk;
u_int inp_rtableid;
int inp_pipex; /* pipex indication */
int inp_divertfl; /* divert flags */
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index b99460f2523..9ff92af4a50 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.205 2013/03/28 16:45:16 tedu Exp $ */
+/* $OpenBSD: ip_input.c,v 1.206 2013/03/29 13:16:14 bluhm Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -672,7 +672,7 @@ in_ouraddr(struct in_addr ina, struct mbuf *m)
if (m->m_pkthdr.pf.flags & PF_TAG_DIVERTED)
return (1);
- key = (struct pf_state_key *)m->m_pkthdr.pf.statekey;
+ key = m->m_pkthdr.pf.statekey;
if (key != NULL) {
if (key->inp != NULL)
return (1);
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 2bd8a50609f..e3dba6a0cda 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.257 2013/03/28 23:10:06 tedu Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.258 2013/03/29 13:16:14 bluhm Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -594,7 +594,7 @@ tcp_input(struct mbuf *m, ...)
*/
#if NPF > 0
if (m->m_pkthdr.pf.statekey)
- inp = ((struct pf_state_key *)m->m_pkthdr.pf.statekey)->inp;
+ inp = m->m_pkthdr.pf.statekey->inp;
#endif
findpcb:
if (inp == NULL) {
@@ -613,8 +613,7 @@ findpcb:
}
#if NPF > 0
if (m->m_pkthdr.pf.statekey && inp) {
- ((struct pf_state_key *)m->m_pkthdr.pf.statekey)->inp =
- inp;
+ m->m_pkthdr.pf.statekey->inp = inp;
inp->inp_pf_sk = m->m_pkthdr.pf.statekey;
}
#endif
@@ -882,7 +881,7 @@ findpcb:
#if NPF > 0
if (m->m_pkthdr.pf.statekey) {
- ((struct pf_state_key *)m->m_pkthdr.pf.statekey)->inp = inp;
+ m->m_pkthdr.pf.statekey->inp = inp;
inp->inp_pf_sk = m->m_pkthdr.pf.statekey;
}
/* The statekey has finished finding the inp, it is no longer needed. */
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 0cd83e2ce43..6ca4df8ae57 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.154 2013/03/14 11:18:37 mpi Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.155 2013/03/29 13:16:14 bluhm Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -549,7 +549,7 @@ udp_input(struct mbuf *m, ...)
*/
#if 0
if (m->m_pkthdr.pf.statekey)
- inp = ((struct pf_state_key *)m->m_pkthdr.pf.statekey)->inp;
+ inp = m->m_pkthdr.pf.statekey->inp;
#endif
if (inp == NULL) {
#ifdef INET6
@@ -562,8 +562,7 @@ udp_input(struct mbuf *m, ...)
ip->ip_dst, uh->uh_dport, m->m_pkthdr.rdomain);
#if NPF > 0
if (m->m_pkthdr.pf.statekey && inp) {
- ((struct pf_state_key *)m->m_pkthdr.pf.statekey)->inp =
- inp;
+ m->m_pkthdr.pf.statekey->inp = inp;
inp->inp_pf_sk = m->m_pkthdr.pf.statekey;
}
#endif
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index b5ec6425338..c6a66593846 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbuf.h,v 1.161 2013/02/07 11:06:42 mikeb Exp $ */
+/* $OpenBSD: mbuf.h,v 1.162 2013/03/29 13:16:14 bluhm Exp $ */
/* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */
/*
@@ -78,9 +78,11 @@ struct m_hdr {
};
/* pf stuff */
+struct pf_state_key;
+
struct pkthdr_pf {
void *hdr; /* saved hdr pos in mbuf, for ECN */
- void *statekey; /* pf stackside statekey */
+ struct pf_state_key *statekey; /* pf stackside statekey */
u_int32_t qid; /* queue id */
u_int16_t tag; /* tag id */
u_int8_t flags;