summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_icmp.c
diff options
context:
space:
mode:
authorChristopher Pascoe <pascoe@cvs.openbsd.org>2005-07-31 03:30:56 +0000
committerChristopher Pascoe <pascoe@cvs.openbsd.org>2005-07-31 03:30:56 +0000
commit572772cf7ccf3f3860c0121c89ee22e0001d0692 (patch)
tree610ab2d75d296c730135e6ff5a6fc7544b6f5bf0 /sys/netinet/ip_icmp.c
parent2c25fdbabd0951de2d2c84e82326825b902ced70 (diff)
Change the API for icmp_do_error so that it takes the mtu directly, rather
than a pointer to struct ifnet containing it. Saves a 448 byte stack allocation in ip_forward which previously faked up a struct ifnet just for this purpose. idea ok deraadt millert
Diffstat (limited to 'sys/netinet/ip_icmp.c')
-rw-r--r--sys/netinet/ip_icmp.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 757a629021c..f82e5ab5fe7 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_icmp.c,v 1.67 2005/06/30 08:51:31 markus Exp $ */
+/* $OpenBSD: ip_icmp.c,v 1.68 2005/07/31 03:30:55 pascoe Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@@ -128,8 +128,7 @@ icmp_init(void)
}
struct mbuf *
-icmp_do_error(struct mbuf *n, int type, int code, n_long dest,
- struct ifnet *destifp)
+icmp_do_error(struct mbuf *n, int type, int code, n_long dest, int destmtu)
{
struct ip *oip = mtod(n, struct ip *), *nip;
unsigned oiplen = oip->ip_hl << 2;
@@ -223,8 +222,8 @@ icmp_do_error(struct mbuf *n, int type, int code, n_long dest,
icp->icmp_pptr = code;
code = 0;
} else if (type == ICMP_UNREACH &&
- code == ICMP_UNREACH_NEEDFRAG && destifp)
- icp->icmp_nextmtu = htons(destifp->if_mtu);
+ code == ICMP_UNREACH_NEEDFRAG && destmtu)
+ icp->icmp_nextmtu = htons(destmtu);
}
icp->icmp_code = code;
@@ -274,12 +273,11 @@ freeit:
* The ip packet inside has ip_off and ip_len in host byte order.
*/
void
-icmp_error(struct mbuf *n, int type, int code, n_long dest,
- struct ifnet *destifp)
+icmp_error(struct mbuf *n, int type, int code, n_long dest, int destmtu)
{
struct mbuf *m;
- m = icmp_do_error(n, type, code, dest, destifp);
+ m = icmp_do_error(n, type, code, dest, destmtu);
if (m != NULL)
icmp_reflect(m);
}