summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/nat_cmd.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2000-01-03 20:09:23 +0000
committerbrian <brian@FreeBSD.org>2000-01-03 20:09:23 +0000
commit928cb58803557123834cbc1a360cc2c76de8fe3b (patch)
tree66b14e59b870987bd69cf215347f6b9753f2f5c4 /usr.sbin/ppp/nat_cmd.c
parent4e3562decbae6b85c02a780004c559dfc46b8077 (diff)
downloadFreeBSD-src-928cb58803557123834cbc1a360cc2c76de8fe3b.zip
FreeBSD-src-928cb58803557123834cbc1a360cc2c76de8fe3b.tar.gz
Ensure that there's a bit of extra space in our buffer when it's
passed to libalias. If there's not enough space, things like ftp PORT commands start failing.... Reported by: Gianmarco Giovannelli <gmarco@giovannelli.it>
Diffstat (limited to 'usr.sbin/ppp/nat_cmd.c')
-rw-r--r--usr.sbin/ppp/nat_cmd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/ppp/nat_cmd.c b/usr.sbin/ppp/nat_cmd.c
index bc78929..a2fb917 100644
--- a/usr.sbin/ppp/nat_cmd.c
+++ b/usr.sbin/ppp/nat_cmd.c
@@ -52,6 +52,8 @@
#include "bundle.h"
+#define NAT_EXTRABUF (13)
+
static int StrToAddr(const char *, struct in_addr *);
static int StrToPortRange(const char *, u_short *, u_short *, const char *);
static int StrToAddrAndPort(const char *, struct in_addr *, u_short *,
@@ -344,8 +346,10 @@ nat_LayerPush(struct bundle *bundle, struct link *l, struct mbuf *bp,
log_Printf(LogDEBUG, "nat_LayerPush: PROTO_IP -> PROTO_IP\n");
m_settype(bp, MB_NATOUT);
- bp = m_pullup(bp);
+ /* Ensure there's a bit of extra buffer for the NAT code... */
+ bp = m_pullup(m_append(bp, NULL, NAT_EXTRABUF));
PacketAliasOut(MBUF_CTOP(bp), bp->m_len);
+ bp->m_len = ntohs(((struct ip *)MBUF_CTOP(bp))->ip_len);
return bp;
}
@@ -372,6 +376,8 @@ nat_LayerPull(struct bundle *bundle, struct link *l, struct mbuf *bp,
(pip->ip_p == IPPROTO_IPIP && IN_CLASSD(ntohl(piip->ip_dst.s_addr))))
return bp;
+ /* Ensure there's a bit of extra buffer for the NAT code... */
+ bp = m_pullup(m_append(bp, NULL, NAT_EXTRABUF));
ret = PacketAliasIn(MBUF_CTOP(bp), bp->m_len);
bp->m_len = ntohs(pip->ip_len);
OpenPOWER on IntegriCloud