Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jan 1998 17:07:21 -0500 (EST)
From:      ajl8039@osfmail.isc.rit.edu
To:        hackers@FreeBSD.ORG
Subject:   iijppp dynamic IP suggestions (inc. diffs)
Message-ID:  <199801142207.RAA27529@grace.isc.rit.edu>

next in thread | raw e-mail | index | archive | help
I use iijppp at home to give a small network of machines access to
the Internet.  My provider assigns me a dynamic IP address, and my
local network is a simple TCP/IP 10base2 ethernet.  I run named
with authority for my private domain and a forwarders list pointing
to my ISP's nameservers.

I've had two problems with iijppp.  First, TCP FIN and RST packets
would cause a dial-up.  A one line hack fixed this, and could be
made more general.  Second, the initial packets sent out over the
modem would come back (if they came back at all) with the make-believe
IP address given to "set ifaddr".  I hacked this to work by aliasing
(masquerading) only after the link had gone up and setting up an
IP alias (second address) for the tunnel device.  The ugly part is
forcing mbuf.c to allocate MAX_MRU bytes for every packet in the
IP queue since aliasing can increase packet size.

Of course, the initial packets are important since I run named and
not every connection with the Internet starts with a (remote) name
lookup.  Attached are diffs against the directory /usr/src/usr.sbin/ppp
of 2.2.5-RELEASE.  I have also included necessary parts of ppp.conf,
ppp.linkup, and ppp.linkdown.

Aaron Luz
aaron@csh.rit.edu

diff ../ppp/ip.c ./ip.c
174a175,180
> 
> 		/* XXX Hack: never allow TCP with FIN or RST flags set to */
> 		/*     cause a dialup.					  */
> 		if (direction == FL_DIAL && (th->th_flags & (TH_FIN | TH_RST)))
> 			return (A_DENY);
> 
473a480,483
> 	if (mode & MODE_ALIAS) {
> 	  VarPacketAliasOut(MBUF_CTOP(bp), MAX_MRU);
>           bp->cnt = ntohs (((struct ip *) MBUF_CTOP(bp))->ip_len);
> 	}
diff ../ppp/main.c ./main.c
1002,1005d1001
< 	  if (mode & MODE_ALIAS) {
< 	    VarPacketAliasOut(rbuff, sizeof rbuff);
< 	    n = ntohs(((struct ip *) rbuff)->ip_len);
< 	  }
1013,1016d1008
< 	if (mode & MODE_ALIAS) {
< 	  VarPacketAliasOut(rbuff, sizeof rbuff);
< 	  n = ntohs(((struct ip *) rbuff)->ip_len);
< 	}
diff ../ppp/mbuf.c ./mbuf.c
30a31
> #include "hdlc.h" /* XXX for MAX_MRU */
64c65
<   p = (u_char *) malloc(cnt);
---
>   p = (u_char *) malloc(MAX_MRU); /* XXX cnt */
66c67
<     LogPrintf(LogALERT, "failed to allocate memory: %d\n", cnt);
---
>     LogPrintf(LogALERT, "failed to allocate memory: %d\n", MAX_MRU);
70,71c71,72
<   MemMap[type].count += cnt;
<   totalalloced += cnt;
---
>   MemMap[type].count += MAX_MRU; /* XXX */
>   totalalloced += MAX_MRU; /* XXX */
73c74,75
<   bp->size = bp->cnt = cnt;
---
>   bp->size = MAX_MRU; /* XXX */
>   bp->cnt  = cnt;

from /etc/ppp/ppp.conf
myisp:
 set phone ...
 set login ...
 load fake-route

fake-route:
 set ifaddr 10.0.0.1/0 10.0.0.2/0
 delete ALL
 add 0 0 10.0.0.2
 set openmode active

/etc/ppp/ppp.linkup
myisp:
 delete ALL
 add 0 0 HISADDR
 shell ifconfig tun0 10.0.0.1 HISADDR alias

/etc/ppp/ppp.linkdown
myisp:
 shell ifconfig tun0 10.0.0.1 delete
 load fake-route



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801142207.RAA27529>