/[lwip]/lwip/src/netif/ppp/ipcp.c
ViewVC logotype

Diff of /lwip/src/netif/ppp/ipcp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by jani, Fri May 30 08:49:34 2003 UTC revision 1.3 by jani, Mon Jun 2 11:12:56 2003 UTC
# Line 593  static int ipcp_nakci(fsm *f, u_char *p, Line 593  static int ipcp_nakci(fsm *f, u_char *p,
593            if (go->accept_local && ciaddr1) { /* Do we know our address? */            if (go->accept_local && ciaddr1) { /* Do we know our address? */
594                    try.ouraddr = ciaddr1;                    try.ouraddr = ciaddr1;
595                    IPCPDEBUG((LOG_INFO, "local IP address %s\n",                    IPCPDEBUG((LOG_INFO, "local IP address %s\n",
596                               ip_ntoa(ciaddr1)));                               inet_ntoa(ciaddr1)));
597            }            }
598            if (go->accept_remote && ciaddr2) { /* Does he know his? */            if (go->accept_remote && ciaddr2) { /* Does he know his? */
599                    try.hisaddr = ciaddr2;                    try.hisaddr = ciaddr2;
600                    IPCPDEBUG((LOG_INFO, "remote IP address %s\n",                    IPCPDEBUG((LOG_INFO, "remote IP address %s\n",
601                               ip_ntoa(ciaddr2)));                               inet_ntoa(ciaddr2)));
602            }            }
603          );          );
604                    
# Line 633  static int ipcp_nakci(fsm *f, u_char *p, Line 633  static int ipcp_nakci(fsm *f, u_char *p,
633                    
634          NAKCIDNS(CI_MS_DNS1, req_dns1,          NAKCIDNS(CI_MS_DNS1, req_dns1,
635                          try.dnsaddr[0] = cidnsaddr;                          try.dnsaddr[0] = cidnsaddr;
636                          IPCPDEBUG((LOG_INFO, "primary DNS address %s\n", ip_ntoa(cidnsaddr)));                          IPCPDEBUG((LOG_INFO, "primary DNS address %s\n", inet_ntoa(cidnsaddr)));
637                          );                          );
638    
639          NAKCIDNS(CI_MS_DNS2, req_dns2,          NAKCIDNS(CI_MS_DNS2, req_dns2,
640                          try.dnsaddr[1] = cidnsaddr;                          try.dnsaddr[1] = cidnsaddr;
641                          IPCPDEBUG((LOG_INFO, "secondary DNS address %s\n", ip_ntoa(cidnsaddr)));                          IPCPDEBUG((LOG_INFO, "secondary DNS address %s\n", inet_ntoa(cidnsaddr)));
642                          );                          );
643    
644          /*          /*
# Line 898  static int ipcp_reqci( Line 898  static int ipcp_reqci(
898                           */                           */
899                          GETLONG(tl, p);         /* Parse source address (his) */                          GETLONG(tl, p);         /* Parse source address (his) */
900                          ciaddr1 = htonl(tl);                          ciaddr1 = htonl(tl);
901                          IPCPDEBUG((LOG_INFO, "his addr %s\n", ip_ntoa(ciaddr1)));                          IPCPDEBUG((LOG_INFO, "his addr %s\n", inet_ntoa(ciaddr1)));
902                          if (ciaddr1 != wo->hisaddr                          if (ciaddr1 != wo->hisaddr
903                                          && (ciaddr1 == 0 || !wo->accept_remote)) {                                          && (ciaddr1 == 0 || !wo->accept_remote)) {
904                                  orc = CONFNAK;                                  orc = CONFNAK;
# Line 922  static int ipcp_reqci( Line 922  static int ipcp_reqci(
922                           */                           */
923                          GETLONG(tl, p);         /* Parse desination address (ours) */                          GETLONG(tl, p);         /* Parse desination address (ours) */
924                          ciaddr2 = htonl(tl);                          ciaddr2 = htonl(tl);
925                          IPCPDEBUG((LOG_INFO, "our addr %s\n", ip_ntoa(ciaddr2)));                          IPCPDEBUG((LOG_INFO, "our addr %s\n", inet_ntoa(ciaddr2)));
926                          if (ciaddr2 != wo->ouraddr) {                          if (ciaddr2 != wo->ouraddr) {
927                                  if (ciaddr2 == 0 || !wo->accept_local) {                                  if (ciaddr2 == 0 || !wo->accept_local) {
928                                          orc = CONFNAK;                                          orc = CONFNAK;
# Line 970  static int ipcp_reqci( Line 970  static int ipcp_reqci(
970                                          tl = ntohl(wo->hisaddr);                                          tl = ntohl(wo->hisaddr);
971                                          PUTLONG(tl, p);                                          PUTLONG(tl, p);
972                                  }                                  }
973                                  IPCPDEBUG((LOG_INFO, "ipcp_reqci: Nak ADDR %s\n", ip_ntoa(ciaddr1)));                                  IPCPDEBUG((LOG_INFO, "ipcp_reqci: Nak ADDR %s\n", inet_ntoa(ciaddr1)));
974                          } else if (ciaddr1 == 0 && wo->hisaddr == 0) {                          } else if (ciaddr1 == 0 && wo->hisaddr == 0) {
975                                  /*                                  /*
976                                   * Don't ACK an address of 0.0.0.0 - reject it instead.                                   * Don't ACK an address of 0.0.0.0 - reject it instead.
977                                   */                                   */
978                                  IPCPDEBUG((LOG_INFO, "ipcp_reqci: Reject ADDR %s\n", ip_ntoa(ciaddr1)));                                  IPCPDEBUG((LOG_INFO, "ipcp_reqci: Reject ADDR %s\n", inet_ntoa(ciaddr1)));
979                                  orc = CONFREJ;                                  orc = CONFREJ;
980                                  wo->req_addr = 0;       /* don't NAK with 0.0.0.0 later */                                  wo->req_addr = 0;       /* don't NAK with 0.0.0.0 later */
981                                  break;                                  break;
# Line 983  static int ipcp_reqci( Line 983  static int ipcp_reqci(
983                                                    
984                          ho->neg_addr = 1;                          ho->neg_addr = 1;
985                          ho->hisaddr = ciaddr1;                          ho->hisaddr = ciaddr1;
986                          IPCPDEBUG((LOG_INFO, "ipcp_reqci: ADDR %s\n", ip_ntoa(ciaddr1)));                          IPCPDEBUG((LOG_INFO, "ipcp_reqci: ADDR %s\n", inet_ntoa(ciaddr1)));
987                          break;                          break;
988                                    
989                  case CI_MS_DNS1:                  case CI_MS_DNS1:
# Line 1001  static int ipcp_reqci( Line 1001  static int ipcp_reqci(
1001                          GETLONG(tl, p);                          GETLONG(tl, p);
1002                          if (htonl(tl) != ao->dnsaddr[d]) {                          if (htonl(tl) != ao->dnsaddr[d]) {
1003                                  IPCPDEBUG((LOG_INFO, "ipcp_reqci: Naking DNS%d Request %d\n",                                  IPCPDEBUG((LOG_INFO, "ipcp_reqci: Naking DNS%d Request %d\n",
1004                                                          d+1, ip_ntoa(tl)));                                                          d+1, inet_ntoa(tl)));
1005                                  DECPTR(sizeof(u32_t), p);                                  DECPTR(sizeof(u32_t), p);
1006                                  tl = ntohl(ao->dnsaddr[d]);                                  tl = ntohl(ao->dnsaddr[d]);
1007                                  PUTLONG(tl, p);                                  PUTLONG(tl, p);
# Line 1211  static void ipcp_up(fsm *f) Line 1211  static void ipcp_up(fsm *f)
1211           */           */
1212          if (!auth_ip_addr(f->unit, ho->hisaddr)) {          if (!auth_ip_addr(f->unit, ho->hisaddr)) {
1213                  ppp_trace(LOG_ERR, "Peer is not authorized to use remote address %s\n",                  ppp_trace(LOG_ERR, "Peer is not authorized to use remote address %s\n",
1214                                  ip_ntoa(ho->hisaddr));                                  inet_ntoa(ho->hisaddr));
1215                  ipcp_close(f->unit, "Unauthorized remote IP address");                  ipcp_close(f->unit, "Unauthorized remote IP address");
1216                  return;                  return;
1217          }          }
# Line 1224  static void ipcp_up(fsm *f) Line 1224  static void ipcp_up(fsm *f)
1224           */           */
1225          mask = GetMask(go->ouraddr);          mask = GetMask(go->ouraddr);
1226                    
1227  #if !(defined(SVR4) && (defined(SNI) || defined(__USLC__)))          if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask, go->dnsaddr[0], go->dnsaddr[1])) {
         if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask)) {  
1228                  IPCPDEBUG((LOG_WARNING, "sifaddr failed\n"));                  IPCPDEBUG((LOG_WARNING, "sifaddr failed\n"));
1229                  ipcp_close(f->unit, "Interface configuration failed");                  ipcp_close(f->unit, "Interface configuration failed");
1230                  return;                  return;
1231          }          }
 #endif  
1232                    
1233          /* bring the interface up for IP */          /* bring the interface up for IP */
1234          if (!sifup(f->unit)) {          if (!sifup(f->unit)) {
# Line 1239  static void ipcp_up(fsm *f) Line 1237  static void ipcp_up(fsm *f)
1237                  return;                  return;
1238          }          }
1239                    
 #if (defined(SVR4) && (defined(SNI) || defined(__USLC__)))  
         if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask)) {  
                 IPCPDEBUG((LOG_WARNING, "sifaddr failed\n"));  
                 ipcp_close(f->unit, "Interface configuration failed");  
                 return;  
         }  
 #endif  
1240          sifnpmode(f->unit, PPP_IP, NPMODE_PASS);          sifnpmode(f->unit, PPP_IP, NPMODE_PASS);
1241                    
1242          /* assign a default route through the interface if required */          /* assign a default route through the interface if required */
# Line 1253  static void ipcp_up(fsm *f) Line 1244  static void ipcp_up(fsm *f)
1244                  if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr))                  if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr))
1245                          default_route_set[f->unit] = 1;                          default_route_set[f->unit] = 1;
1246                    
1247          IPCPDEBUG((LOG_NOTICE, "local  IP address %s\n", ip_ntoa(go->ouraddr)));          IPCPDEBUG((LOG_NOTICE, "local  IP address %s\n", inet_ntoa(go->ouraddr)));
1248          IPCPDEBUG((LOG_NOTICE, "remote IP address %s\n", ip_ntoa(ho->hisaddr)));          IPCPDEBUG((LOG_NOTICE, "remote IP address %s\n", inet_ntoa(ho->hisaddr)));
1249          if (go->dnsaddr[0]) {          if (go->dnsaddr[0]) {
1250                  IPCPDEBUG((LOG_NOTICE, "primary   DNS address %s\n", ip_ntoa(go->dnsaddr[0])));                  IPCPDEBUG((LOG_NOTICE, "primary   DNS address %s\n", inet_ntoa(go->dnsaddr[0])));
1251          }          }
1252          if (go->dnsaddr[1]) {          if (go->dnsaddr[1]) {
1253                  IPCPDEBUG((LOG_NOTICE, "secondary DNS address %s\n", ip_ntoa(go->dnsaddr[1])));                  IPCPDEBUG((LOG_NOTICE, "secondary DNS address %s\n", inet_ntoa(go->dnsaddr[1])));
1254          }          }
1255  }  }
1256    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26