Correct the forth arg to "set ifaddr". If specified,

it gives the IP number that should be used for initial
IPCP config requests, irrespective of MYADDR.
This commit is contained in:
Brian Somers 1997-08-19 01:10:24 +00:00
parent 891e0f24c4
commit 3f6fd9230e
5 changed files with 132 additions and 56 deletions

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: command.c,v 1.68 1997/08/17 20:45:45 brian Exp $
* $Id: command.c,v 1.69 1997/08/18 20:15:09 brian Exp $
*
*/
#include <sys/types.h>
@ -1093,11 +1093,14 @@ struct cmdtab *list;
int argc;
char **argv;
{
DefMyAddress.ipaddr.s_addr = DefHisAddress.ipaddr.s_addr = 0L;
if (argc > 4)
return -1;
HaveTriggerAddress = 0;
ifnetmask.s_addr = 0;
if (argc > 0) {
if (ParseAddr(argc, argv++,
&DefMyAddress.ipaddr,
@ -1113,15 +1116,13 @@ char **argv;
if (--argc > 0) {
ifnetmask = GetIpAddr(*argv);
if (--argc > 0) {
if (ParseAddr(argc, argv++,
&DefTriggerAddress.ipaddr,
&DefTriggerAddress.mask,
&DefTriggerAddress.width) == 0)
return 3;
TriggerAddress = GetIpAddr(*argv);
HaveTriggerAddress = 1;
}
}
}
}
/*
* For backwards compatibility, 0.0.0.0 means any address.
*/

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ipcp.c,v 1.22 1997/06/25 19:30:00 brian Exp $
* $Id: ipcp.c,v 1.23 1997/07/29 22:37:04 brian Exp $
*
* TODO:
* o More RFC1772 backwoard compatibility
@ -42,7 +42,9 @@ extern void Prompt();
extern struct in_addr ifnetmask;
struct ipcpstate IpcpInfo;
struct in_range DefMyAddress, DefHisAddress, DefTriggerAddress;
struct in_range DefMyAddress, DefHisAddress;
struct in_addr TriggerAddress;
int HaveTriggerAddress;
#ifndef NOMSEXT
struct in_addr ns_entries[2], nbns_entries[2];
@ -137,8 +139,10 @@ ReportIpcpStatus()
inet_ntoa(DefMyAddress.ipaddr), DefMyAddress.width);
fprintf(VarTerm, " His Address: %s/%d\n",
inet_ntoa(DefHisAddress.ipaddr), DefHisAddress.width);
fprintf(VarTerm, " Negotiation: %s/%d\n",
inet_ntoa(DefTriggerAddress.ipaddr), DefTriggerAddress.width);
if (HaveTriggerAddress)
fprintf(VarTerm, " Negotiation(trigger): %s\n", inet_ntoa(TriggerAddress));
else
fprintf(VarTerm, " Negotiation(trigger): MYADDR\n");
return 0;
}
@ -151,7 +155,8 @@ IpcpDefAddress()
bzero(&DefMyAddress, sizeof(DefMyAddress));
bzero(&DefHisAddress, sizeof(DefHisAddress));
bzero(&DefTriggerAddress, sizeof(DefTriggerAddress));
TriggerAddress.s_addr = 0;
HaveTriggerAddress = 0;
if (gethostname(name, sizeof(name)) == 0) {
hp = gethostbyname(name);
if (hp && hp->h_addrtype == AF_INET) {
@ -180,8 +185,9 @@ IpcpInit()
* even though standard of PPP is defined full negotiation based.
* (e.g. "0.0.0.0" or Not "0.0.0.0")
*/
if ( icp->want_ipaddr.s_addr == 0 ) {
icp->want_ipaddr.s_addr = DefTriggerAddress.ipaddr.s_addr;
if (HaveTriggerAddress) {
icp->want_ipaddr.s_addr = TriggerAddress.s_addr;
LogPrintf(LogLCP, "Using trigger address %s\n", inet_ntoa(TriggerAddress));
}
if (Enabled(ConfVjcomp))

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ipcp.h,v 1.6 1997/02/22 16:10:22 peter Exp $
* $Id: ipcp.h,v 1.7 1997/06/09 03:27:24 brian Exp $
*
* TODO:
*/
@ -65,7 +65,8 @@ struct in_range {
extern struct ipcpstate IpcpInfo;
extern struct in_range DefMyAddress;
extern struct in_range DefHisAddress;
extern struct in_range DefTriggerAddress;
extern struct in_addr TriggerAddress;
extern int HaveTriggerAddress;
#ifndef NOMSEXT
extern struct in_addr ns_entries[2];

View File

@ -1,4 +1,4 @@
.\" $Id: ppp.8,v 1.49 1997/08/17 22:45:25 brian Exp $
.\" $Id: ppp.8,v 1.50 1997/08/18 20:15:10 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -937,34 +937,53 @@ To control this IPCP behavior, this implementation has the
.Dq set ifaddr
command for defining the local and remote IP address:
.Nm set ifaddr
.Op src_addr Op dst_addr Op netmask
.Bd -literal -offset indent
set ifaddr [src_addr [dst_addr [netmask [trigger_addr]]]]
.Ed
Where,
where,
.Sq src_addr
is the IP address that the local side is willing to use and
is the IP address that the local side is willing to use,
.Sq dst_addr
is the IP address which the remote side should use.
is the IP address which the remote side should use and
.Sq netmask
is interface netmask.
is the netmask that should be used.
.Sq Src_addr
and
.Sq dst_addr
default to 0.0.0.0, and
.Sq netmask
defaults to whatever mask is appropriate for
.Sq src_addr .
It is only possible to make
.Sq netmask
smaller than the default. The usual value is 255.255.255.255.
Some incorrect ppp implementations require that the peer negotiates
a specific IP address instead of
.Sq src_addr .
If this is the case,
.Sq trigger_addr
may be used to specify this IP number. This will not affect the
routing table unless the other side agrees with this proposed number.
.Bd -literal -offset indent
set ifaddr 192.244.177.38 192.244.177.2 255.255.255.0
set ifaddr 192.244.177.38 192.244.177.2 255.255.255.255 0.0.0.0
.Ed
The above specification means:
.Bl -bullet -compact
.It
I strongly want to use 192.244.177.38 as my IP address, and I'll
disagree if the peer suggests that I use another address.
I will first suggest that my IP address should be 0.0.0.0, but I
will only accept an address of 192.244.177.38.
.It
I strongly insist that peer use 192.244.177.2 as own side address and
don't permit it to use any IP address but 192.244.177.2. When peer
request another IP address, I always suggest that it use 192.244.177.2.
I strongly insist that the peer uses 192.244.177.2 as his own
address and won't permit the use of any IP address but 192.244.177.2.
When the peer requests another IP address, I will always suggest that
it uses 192.244.177.2.
.It
My interface netmask will be 255.255.255.0.
The routing table entry will have a netmask of 0xffffffff.
.El
This is all fine when each side has a pre-determined IP address, however
@ -1134,28 +1153,35 @@ rates of 28800 or more. In general, the serial speed should be about
four times the modem speed.
.It
Use
Use the
.Dq set ifaddr
command to define the IP address.
.Bl -bullet
.It
If you know what IP address your provider uses, then use it as the remote
address, otherwise choose something like 10.0.0.2/0 (see below).
address (dst_addr), otherwise choose something like 10.0.0.2/0 (see below).
.It
If your provider has assigned a particular IP address to you, then use
it as your address.
it as your address (src_addr).
.It
If your provider assigns your address dynamically, choose a suitably
unobtrusive and unspecific IP number as your address. 10.0.0.1/0 would
be appropriate. The bit after the / specifies how many bits of the
address you consider to be important, so if you wanted to insist on
something in the class C network 1.2.3.0, you could specify 1.2.3.1/24.
.It
If you find that your ISP accepts the first IP number that you suggest,
specify third and forth arguments of
.Dq 0.0.0.0 .
This will force your ISP to assign a number. (The third argument will
be ignored as it is less restrictive than the default mask for your
.Sq src_addr .
.El
.Pp
An example for a connection where you don't know your IP number or your
ISPs IP number would be:
.Bd -literal -offset indent
set ifaddr 10.10.10.10/0 10.10.11.11/0 255.255.255.0
set ifaddr 10.10.10.10/0 10.10.11.11/0 0.0.0.0 0.0.0.0
.Ed
.It
@ -1597,9 +1623,9 @@ This option is similar to the
option above. It allows the user to specify a set of characters that
will be `escaped' as they travel across the link.
.It set ifaddr myaddr hisaddr mask
.It set ifaddr [myaddr [hisaddr [netmask [triggeraddr]]]]
This command specifies the IP addresses that will be used during
LCP negotiation. Addresses are specified using the format
IPCP negotiation. Addresses are specified using the format
.Dl a.b.c.d/n
@ -1608,6 +1634,14 @@ of the address we will insist on. If the /n bit is omitted, it
defaults to /32 unless the IP address is 0.0.0.0 in which case
the mask defaults to /0.
If
.Dq triggeraddr
is specified, it is used in place of
.Dq myaddr
in the initial IPCP negotiation. However, only an address in the
.Dq myaddr
range will be accepted.
.It set log [+|-]value...
This command allows the adjustment of the current log level. Please
refer to the Logging Facility section for further details.

View File

@ -1,4 +1,4 @@
.\" $Id: ppp.8,v 1.49 1997/08/17 22:45:25 brian Exp $
.\" $Id: ppp.8,v 1.50 1997/08/18 20:15:10 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -937,34 +937,53 @@ To control this IPCP behavior, this implementation has the
.Dq set ifaddr
command for defining the local and remote IP address:
.Nm set ifaddr
.Op src_addr Op dst_addr Op netmask
.Bd -literal -offset indent
set ifaddr [src_addr [dst_addr [netmask [trigger_addr]]]]
.Ed
Where,
where,
.Sq src_addr
is the IP address that the local side is willing to use and
is the IP address that the local side is willing to use,
.Sq dst_addr
is the IP address which the remote side should use.
is the IP address which the remote side should use and
.Sq netmask
is interface netmask.
is the netmask that should be used.
.Sq Src_addr
and
.Sq dst_addr
default to 0.0.0.0, and
.Sq netmask
defaults to whatever mask is appropriate for
.Sq src_addr .
It is only possible to make
.Sq netmask
smaller than the default. The usual value is 255.255.255.255.
Some incorrect ppp implementations require that the peer negotiates
a specific IP address instead of
.Sq src_addr .
If this is the case,
.Sq trigger_addr
may be used to specify this IP number. This will not affect the
routing table unless the other side agrees with this proposed number.
.Bd -literal -offset indent
set ifaddr 192.244.177.38 192.244.177.2 255.255.255.0
set ifaddr 192.244.177.38 192.244.177.2 255.255.255.255 0.0.0.0
.Ed
The above specification means:
.Bl -bullet -compact
.It
I strongly want to use 192.244.177.38 as my IP address, and I'll
disagree if the peer suggests that I use another address.
I will first suggest that my IP address should be 0.0.0.0, but I
will only accept an address of 192.244.177.38.
.It
I strongly insist that peer use 192.244.177.2 as own side address and
don't permit it to use any IP address but 192.244.177.2. When peer
request another IP address, I always suggest that it use 192.244.177.2.
I strongly insist that the peer uses 192.244.177.2 as his own
address and won't permit the use of any IP address but 192.244.177.2.
When the peer requests another IP address, I will always suggest that
it uses 192.244.177.2.
.It
My interface netmask will be 255.255.255.0.
The routing table entry will have a netmask of 0xffffffff.
.El
This is all fine when each side has a pre-determined IP address, however
@ -1134,28 +1153,35 @@ rates of 28800 or more. In general, the serial speed should be about
four times the modem speed.
.It
Use
Use the
.Dq set ifaddr
command to define the IP address.
.Bl -bullet
.It
If you know what IP address your provider uses, then use it as the remote
address, otherwise choose something like 10.0.0.2/0 (see below).
address (dst_addr), otherwise choose something like 10.0.0.2/0 (see below).
.It
If your provider has assigned a particular IP address to you, then use
it as your address.
it as your address (src_addr).
.It
If your provider assigns your address dynamically, choose a suitably
unobtrusive and unspecific IP number as your address. 10.0.0.1/0 would
be appropriate. The bit after the / specifies how many bits of the
address you consider to be important, so if you wanted to insist on
something in the class C network 1.2.3.0, you could specify 1.2.3.1/24.
.It
If you find that your ISP accepts the first IP number that you suggest,
specify third and forth arguments of
.Dq 0.0.0.0 .
This will force your ISP to assign a number. (The third argument will
be ignored as it is less restrictive than the default mask for your
.Sq src_addr .
.El
.Pp
An example for a connection where you don't know your IP number or your
ISPs IP number would be:
.Bd -literal -offset indent
set ifaddr 10.10.10.10/0 10.10.11.11/0 255.255.255.0
set ifaddr 10.10.10.10/0 10.10.11.11/0 0.0.0.0 0.0.0.0
.Ed
.It
@ -1597,9 +1623,9 @@ This option is similar to the
option above. It allows the user to specify a set of characters that
will be `escaped' as they travel across the link.
.It set ifaddr myaddr hisaddr mask
.It set ifaddr [myaddr [hisaddr [netmask [triggeraddr]]]]
This command specifies the IP addresses that will be used during
LCP negotiation. Addresses are specified using the format
IPCP negotiation. Addresses are specified using the format
.Dl a.b.c.d/n
@ -1608,6 +1634,14 @@ of the address we will insist on. If the /n bit is omitted, it
defaults to /32 unless the IP address is 0.0.0.0 in which case
the mask defaults to /0.
If
.Dq triggeraddr
is specified, it is used in place of
.Dq myaddr
in the initial IPCP negotiation. However, only an address in the
.Dq myaddr
range will be accepted.
.It set log [+|-]value...
This command allows the adjustment of the current log level. Please
refer to the Logging Facility section for further details.