diff options
author | brian <brian@FreeBSD.org> | 1997-08-21 16:21:39 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-08-21 16:21:39 +0000 |
commit | 263a0e79cc4756de756f7812ae9239dfee01b6f5 (patch) | |
tree | 470b83e0d1dde5c3880dc714326a9154a6f12207 /usr.sbin/ppp/main.c | |
parent | 4d5bf5e7506b847a254ed4a60c60cf849b36fb59 (diff) | |
download | FreeBSD-src-263a0e79cc4756de756f7812ae9239dfee01b6f5.zip FreeBSD-src-263a0e79cc4756de756f7812ae9239dfee01b6f5.tar.gz |
Add "set loopback on|off", defaulting to "on".
This tells ppp to loopback packets addressed to
the ppp interface IP coming *from* the tun
device.
This means that you can ping the tun interface IP
from inside :-)
Diffstat (limited to 'usr.sbin/ppp/main.c')
-rw-r--r-- | usr.sbin/ppp/main.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index 75ad657..694e6f8 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: main.c,v 1.68 1997/06/29 13:54:31 brian Exp $ + * $Id: main.c,v 1.69 1997/07/01 21:31:23 brian Exp $ * * TODO: * o Add commands for traffic summary, version display, etc. @@ -51,6 +51,7 @@ #include "ip.h" #include "sig.h" #include "server.h" +#include "lcpproto.h" #define LAUTH_M1 "Warning: No password entry for this host in ppp.secret\n" #define LAUTH_M2 "Warning: Manipulation is allowed by anyone\n" @@ -1013,6 +1014,27 @@ DoLoop() LogPrintf(LogERROR, "read from tun: %s", strerror(errno)); continue; } + + if (((struct ip *)rbuff)->ip_dst.s_addr == IpcpInfo.want_ipaddr.s_addr) { + /* we've been asked to send something addressed *to* us :( */ + if (VarLoopback) { + pri = PacketCheck(rbuff, n, FL_IN); + if (pri >= 0) { + struct mbuf *bp; + if (mode & MODE_ALIAS) { + VarPacketAliasIn(rbuff, sizeof rbuff); + n = ntohs(((struct ip *)rbuff)->ip_len); + } + bp = mballoc(n, MB_IPIN); + bcopy(rbuff, MBUF_CTOP(bp), n); + IpInput(bp); + LogPrintf(LogDEBUG, "Looped back packet addressed to myself\n"); + } + continue; + } else + LogPrintf(LogDEBUG, "Oops - forwarding packet addressed to myself\n"); + } + /* * Process on-demand dialup. Output packets are queued within tunnel * device until IPCP is opened. |