summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9be4164)
over whether we accept addresses from the peer.
-static char rcsid[] = "$Id: ipcp.c,v 1.1 1993/11/11 03:54:25 paulus Exp $";
+static char rcsid[] = "$Id: ipcp.c,v 1.2 1994/02/08 23:49:52 paulus Exp $";
- * Fix IP address negotiation (wantoptions or hisoptions).
- * Don't set zero IP addresses.
ipcp_options *wo = &ipcp_wantoptions[f->unit];
wo->req_addr = wo->neg_addr && ipcp_allowoptions[f->unit].neg_addr;
ipcp_options *wo = &ipcp_wantoptions[f->unit];
wo->req_addr = wo->neg_addr && ipcp_allowoptions[f->unit].neg_addr;
+ if (wo->ouraddr == 0)
+ wo->accept_local = 1;
+ if (wo->hisaddr == 0)
+ wo->accept_remote = 1;
ipcp_gotoptions[f->unit] = *wo;
cis_received[f->unit] = 0;
}
ipcp_gotoptions[f->unit] = *wo;
cis_received[f->unit] = 0;
}
- * Accept the peer's idea of our address if we don't know it.
- * Accept the peer's idea of his address if he knows it.
+ * Accept the peer's idea of {our,his} address, if different
+ * from our idea, only if the accept_{local,remote} flag is set.
*/
NAKCIADDR(CI_ADDR, neg_addr, go->old_addrs,
*/
NAKCIADDR(CI_ADDR, neg_addr, go->old_addrs,
- if (!go->ouraddr && ciaddr1) { /* Do we know our address? */
+ if (go->accept_local && ciaddr1) { /* Do we know our address? */
go->ouraddr = ciaddr1;
IPCPDEBUG((LOG_INFO, "local IP address %s",
ip_ntoa(ciaddr1)));
}
go->ouraddr = ciaddr1;
IPCPDEBUG((LOG_INFO, "local IP address %s",
ip_ntoa(ciaddr1)));
}
- if (ciaddr2) { /* Does he know his? */
+ if (go->accept_remote && ciaddr2) { /* Does he know his? */
go->hisaddr = ciaddr2;
IPCPDEBUG((LOG_INFO, "remote IP address %s",
ip_ntoa(ciaddr2)));
go->hisaddr = ciaddr2;
IPCPDEBUG((LOG_INFO, "remote IP address %s",
ip_ntoa(ciaddr2)));
try.old_addrs = 1;
GETLONG(l, p);
ciaddr1 = htonl(l);
try.old_addrs = 1;
GETLONG(l, p);
ciaddr1 = htonl(l);
+ if (ciaddr1 && go->accept_local)
try.ouraddr = ciaddr1;
GETLONG(l, p);
ciaddr2 = htonl(l);
try.ouraddr = ciaddr1;
GETLONG(l, p);
ciaddr2 = htonl(l);
+ if (ciaddr2 && go->accept_remote)
try.hisaddr = ciaddr2;
no.old_addrs = 1;
break;
try.hisaddr = ciaddr2;
no.old_addrs = 1;
break;
try.old_addrs = 0;
GETLONG(l, p);
ciaddr1 = htonl(l);
try.old_addrs = 0;
GETLONG(l, p);
ciaddr1 = htonl(l);
+ if (ciaddr1 && go->accept_local)
try.ouraddr = ciaddr1;
no.neg_addr = 1;
break;
try.ouraddr = ciaddr1;
no.neg_addr = 1;
break;
GETLONG(tl, p); /* Parse source address (his) */
ciaddr1 = htonl(tl);
IPCPDEBUG((LOG_INFO, "(%s:", ip_ntoa(ciaddr1)));
GETLONG(tl, p); /* Parse source address (his) */
ciaddr1 = htonl(tl);
IPCPDEBUG((LOG_INFO, "(%s:", ip_ntoa(ciaddr1)));
- if (wo->hisaddr && ciaddr1 != wo->hisaddr) {
+ if (ciaddr1 != wo->hisaddr
+ && (ciaddr1 == 0 || !wo->accept_remote)) {
orc = CONFNAK;
if (!reject_if_disagree) {
DECPTR(sizeof (long), p);
orc = CONFNAK;
if (!reject_if_disagree) {
DECPTR(sizeof (long), p);
GETLONG(tl, p); /* Parse desination address (ours) */
ciaddr2 = htonl(tl);
IPCPDEBUG((LOG_INFO, "%s)", ip_ntoa(ciaddr2)));
GETLONG(tl, p); /* Parse desination address (ours) */
ciaddr2 = htonl(tl);
IPCPDEBUG((LOG_INFO, "%s)", ip_ntoa(ciaddr2)));
- if (wo->ouraddr && ciaddr2 != wo->ouraddr) {
- orc = CONFNAK;
- if (!reject_if_disagree) {
- DECPTR(sizeof (long), p);
- tl = ntohl(wo->ouraddr);
- PUTLONG(tl, p);
+ if (ciaddr2 != wo->ouraddr) {
+ if (ciaddr2 == 0 || !wo->accept_local) {
+ orc = CONFNAK;
+ if (!reject_if_disagree) {
+ DECPTR(sizeof (long), p);
+ tl = ntohl(wo->ouraddr);
+ PUTLONG(tl, p);
+ }
+ } else {
+ go->ouraddr = ciaddr2; /* accept peer's idea */
GETLONG(tl, p); /* Parse source address (his) */
ciaddr1 = htonl(tl);
IPCPDEBUG((LOG_INFO, "(%s)", ip_ntoa(ciaddr1)));
GETLONG(tl, p); /* Parse source address (his) */
ciaddr1 = htonl(tl);
IPCPDEBUG((LOG_INFO, "(%s)", ip_ntoa(ciaddr1)));
- if (wo->hisaddr && ciaddr1 != wo->hisaddr) {
+ if (ciaddr1 != wo->hisaddr
+ && (ciaddr1 == 0 || !wo->accept_remote)) {
orc = CONFNAK;
if (!reject_if_disagree) {
DECPTR(sizeof (long), p);
orc = CONFNAK;
if (!reject_if_disagree) {
DECPTR(sizeof (long), p);
/*
* We must have a non-zero IP address for both ends of the link.
*/
/*
* We must have a non-zero IP address for both ends of the link.
*/
ho->hisaddr = ipcp_wantoptions[f->unit].hisaddr;
if (ho->hisaddr == 0) {
ho->hisaddr = ipcp_wantoptions[f->unit].hisaddr;
if (ho->hisaddr == 0) {
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ipcp.h,v 1.1 1993/11/11 03:54:25 paulus Exp $
+ * $Id: ipcp.h,v 1.2 1994/02/08 23:49:37 paulus Exp $
int proxy_arp : 1; /* Make proxy ARP entry for peer? */
int neg_vj : 1; /* Van Jacobson Compression? */
int old_vj : 1; /* use old (short) form of VJ option? */
int proxy_arp : 1; /* Make proxy ARP entry for peer? */
int neg_vj : 1; /* Van Jacobson Compression? */
int old_vj : 1; /* use old (short) form of VJ option? */
+ int accept_local : 1; /* accept peer's value for ouraddr */
+ int accept_remote : 1; /* accept peer's value for hisaddr */
u_short vj_protocol; /* protocol value to use in VJ option */
u_char maxslotindex, cflag; /* values for RFC1332 VJ compression neg. */
u_long ouraddr, hisaddr; /* Addresses in NETWORK BYTE ORDER */
u_short vj_protocol; /* protocol value to use in VJ option */
u_char maxslotindex, cflag; /* values for RFC1332 VJ compression neg. */
u_long ouraddr, hisaddr; /* Addresses in NETWORK BYTE ORDER */