summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_output.c
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2003-11-14 21:48:57 +0000
committerandre <andre@FreeBSD.org>2003-11-14 21:48:57 +0000
commit30ed90673d6eaf49ce19a209ecba7e6f2c45ce3e (patch)
tree27563081cd19963af766c97746f7b1b600e28e70 /sys/netinet/ip_output.c
parente83306cda93c90d2842e30a1bc92c5b1089d702b (diff)
downloadFreeBSD-src-30ed90673d6eaf49ce19a209ecba7e6f2c45ce3e.zip
FreeBSD-src-30ed90673d6eaf49ce19a209ecba7e6f2c45ce3e.tar.gz
Remove the global one-level rtcache variable and associated
complex locking and rework ip_rtaddr() to do its own rtlookup. Adopt all its callers to this and make ip_output() callable with NULL rt pointer. Reviewed by: sam (mentor)
Diffstat (limited to 'sys/netinet/ip_output.c')
-rw-r--r--sys/netinet/ip_output.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index fb4bff7..64d4a70 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -142,13 +142,12 @@ ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro,
struct in_ifaddr *ia = NULL;
int isbroadcast, sw_csum;
struct in_addr pkt_dst;
-#ifdef IPSEC
struct route iproute;
+#ifdef IPSEC
struct socket *so;
struct secpolicy *sp = NULL;
#endif
#ifdef FAST_IPSEC
- struct route iproute;
struct m_tag *mtag;
struct secpolicy *sp = NULL;
struct tdb_ident *tdbi;
@@ -202,10 +201,12 @@ ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro,
#endif /*IPSEC*/
M_ASSERTPKTHDR(m);
-#ifndef FAST_IPSEC
- KASSERT(ro != NULL, ("ip_output: no route, proto %d",
- mtod(m, struct ip *)->ip_p));
-#endif
+
+ if (ro == NULL) {
+ ro = &iproute;
+ bzero(ro, sizeof (*ro));
+ }
+
if (inp != NULL)
INP_LOCK_ASSERT(inp);
@@ -256,12 +257,6 @@ ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro,
hlen = ip->ip_hl << 2;
}
-#ifdef FAST_IPSEC
- if (ro == NULL) {
- ro = &iproute;
- bzero(ro, sizeof (*ro));
- }
-#endif /* FAST_IPSEC */
dst = (struct sockaddr_in *)&ro->ro_dst;
/*
* If there is a cached route,
@@ -1089,11 +1084,11 @@ pass:
ipstat.ips_fragmented++;
done:
-#ifdef IPSEC
if (ro == &iproute && ro->ro_rt) {
RTFREE(ro->ro_rt);
ro->ro_rt = NULL;
}
+#ifdef IPSEC
if (sp != NULL) {
KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
printf("DP ip_output call free SP:%p\n", sp));
@@ -1101,10 +1096,6 @@ done:
}
#endif
#ifdef FAST_IPSEC
- if (ro == &iproute && ro->ro_rt) {
- RTFREE(ro->ro_rt);
- ro->ro_rt = NULL;
- }
if (sp != NULL)
KEY_FREESP(&sp);
#endif
OpenPOWER on IntegriCloud