2 * ipcp.c - PPP IP Control Protocol.
4 * Copyright (c) 1989 Carnegie Mellon University.
7 * Redistribution and use in source and binary forms are permitted
8 * provided that the above copyright notice and this paragraph are
9 * duplicated in all such forms and that any documentation,
10 * advertising materials, and other materials related to such
11 * distribution and use acknowledge that the software was developed
12 * by Carnegie Mellon University. The name of the
13 * University may not be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 static char rcsid[] = "$Id: ipcp.c,v 1.3 1994/02/14 04:45:31 paulus Exp $";
30 #include <sys/ioctl.h>
31 #include <sys/types.h>
32 #include <sys/socket.h>
36 #include <net/if_ppp.h>
37 #include <net/route.h>
38 #include <netinet/in.h>
49 ipcp_options ipcp_wantoptions[NPPP]; /* Options that we want to request */
50 ipcp_options ipcp_gotoptions[NPPP]; /* Options that peer ack'd */
51 ipcp_options ipcp_allowoptions[NPPP]; /* Options we allow peer to request */
52 ipcp_options ipcp_hisoptions[NPPP]; /* Options that we ack'd */
55 static int cis_received[NPPP]; /* # Conf-Reqs received */
58 * Callbacks for fsm code. (CI = Configuration Information)
60 static void ipcp_resetci __ARGS((fsm *)); /* Reset our CI */
61 static int ipcp_cilen __ARGS((fsm *)); /* Return length of our CI */
62 static void ipcp_addci __ARGS((fsm *, u_char *, int *)); /* Add our CI */
63 static int ipcp_ackci __ARGS((fsm *, u_char *, int)); /* Peer ack'd our CI */
64 static int ipcp_nakci __ARGS((fsm *, u_char *, int)); /* Peer nak'd our CI */
65 static int ipcp_rejci __ARGS((fsm *, u_char *, int)); /* Peer rej'd our CI */
66 static int ipcp_reqci __ARGS((fsm *, u_char *, int *, int)); /* Rcv CI */
67 static void ipcp_up __ARGS((fsm *)); /* We're UP */
68 static void ipcp_down __ARGS((fsm *)); /* We're DOWN */
71 fsm ipcp_fsm[NPPP]; /* IPCP fsm structure */
73 static fsm_callbacks ipcp_callbacks = { /* IPCP callback routines */
74 ipcp_resetci, /* Reset our Configuration Information */
75 ipcp_cilen, /* Length of our Configuration Information */
76 ipcp_addci, /* Add our Configuration Information */
77 ipcp_ackci, /* ACK our Configuration Information */
78 ipcp_nakci, /* NAK our Configuration Information */
79 ipcp_rejci, /* Reject our Configuration Information */
80 ipcp_reqci, /* Request peer's Configuration Information */
81 ipcp_up, /* Called when fsm reaches OPENED state */
82 ipcp_down, /* Called when fsm leaves OPENED state */
83 NULL, /* Called when we want the lower layer up */
84 NULL, /* Called when we want the lower layer down */
85 NULL, /* Called when Protocol-Reject received */
86 NULL, /* Retransmission is necessary */
87 NULL, /* Called to handle protocol-specific codes */
88 "IPCP" /* String name of protocol */
92 * Lengths of configuration options.
95 #define CILEN_COMPRESS 4 /* min length for compression protocol opt. */
96 #define CILEN_VJ 6 /* length for RFC1332 Van-Jacobson opt. */
97 #define CILEN_ADDR 6 /* new-style single address option */
98 #define CILEN_ADDRS 10 /* old-style dual address option */
101 #define CODENAME(x) ((x) == CONFACK ? "ACK" : \
102 (x) == CONFNAK ? "NAK" : "REJ")
106 * Make a string representation of a network IP address.
114 ipaddr = ntohl(ipaddr);
116 sprintf(b, "%d.%d.%d.%d",
117 (u_char)(ipaddr >> 24),
118 (u_char)(ipaddr >> 16),
119 (u_char)(ipaddr >> 8),
126 * ipcp_init - Initialize IPCP.
132 fsm *f = &ipcp_fsm[unit];
133 ipcp_options *wo = &ipcp_wantoptions[unit];
134 ipcp_options *ao = &ipcp_allowoptions[unit];
138 f->callbacks = &ipcp_callbacks;
139 fsm_init(&ipcp_fsm[unit]);
148 wo->vj_protocol = IPCP_VJ_COMP;
149 wo->maxslotindex = MAX_STATES - 1; /* really max index */
152 /* max slots and slot-id compression are currently hardwired in */
153 /* ppp_if.c to 16 and 1, this needs to be changed (among other */
158 ao->maxslotindex = MAX_STATES - 1;
164 * ipcp_open - IPCP is allowed to come up.
170 fsm_open(&ipcp_fsm[unit]);
175 * ipcp_close - Take IPCP down.
181 fsm_close(&ipcp_fsm[unit]);
186 * ipcp_lowerup - The lower layer is up.
192 fsm_lowerup(&ipcp_fsm[unit]);
197 * ipcp_lowerdown - The lower layer is down.
203 fsm_lowerdown(&ipcp_fsm[unit]);
208 * ipcp_input - Input IPCP packet.
211 ipcp_input(unit, p, len)
216 fsm_input(&ipcp_fsm[unit], p, len);
221 * ipcp_protrej - A Protocol-Reject was received for IPCP.
223 * Pretend the lower layer went down, so we shut up.
229 fsm_lowerdown(&ipcp_fsm[unit]);
234 * ipcp_resetci - Reset our CI.
240 ipcp_options *wo = &ipcp_wantoptions[f->unit];
242 wo->req_addr = wo->neg_addr && ipcp_allowoptions[f->unit].neg_addr;
243 if (wo->ouraddr == 0)
244 wo->accept_local = 1;
245 if (wo->hisaddr == 0)
246 wo->accept_remote = 1;
247 ipcp_gotoptions[f->unit] = *wo;
248 cis_received[f->unit] = 0;
253 * ipcp_cilen - Return length of our CI.
259 ipcp_options *go = &ipcp_gotoptions[f->unit];
261 #define LENCIVJ(neg, old) (neg ? (old? CILEN_COMPRESS : CILEN_VJ) : 0)
262 #define LENCIADDR(neg, old) (neg ? (old? CILEN_ADDRS : CILEN_ADDR) : 0)
264 return (LENCIADDR(go->neg_addr, go->old_addrs) +
265 LENCIVJ(go->neg_vj, go->old_vj));
270 * ipcp_addci - Add our desired CIs to a packet.
273 ipcp_addci(f, ucp, lenp)
278 ipcp_options *wo = &ipcp_wantoptions[f->unit];
279 ipcp_options *go = &ipcp_gotoptions[f->unit];
280 ipcp_options *ho = &ipcp_hisoptions[f->unit];
283 #define ADDCIVJ(opt, neg, val, old, maxslotindex, cflag) \
285 int vjlen = old? CILEN_COMPRESS : CILEN_VJ; \
286 if (len >= vjlen) { \
288 PUTCHAR(vjlen, ucp); \
289 PUTSHORT(val, ucp); \
291 PUTCHAR(maxslotindex, ucp); \
292 PUTCHAR(cflag, ucp); \
299 #define ADDCIADDR(opt, neg, old, val1, val2) \
301 int addrlen = (old? CILEN_ADDRS: CILEN_ADDR); \
302 if (len >= addrlen) { \
305 PUTCHAR(addrlen, ucp); \
318 * First see if we want to change our options to the old
319 * forms because we have received old forms from the peer.
321 if (wo->neg_addr && !go->neg_addr && !go->old_addrs) {
322 /* use the old style of address negotiation */
326 if (wo->neg_vj && !go->neg_vj && !go->old_vj) {
327 /* try an older style of VJ negotiation */
328 if (cis_received[f->unit] == 0) {
329 /* keep trying the new style until we see some CI from the peer */
332 /* use the old style only if the peer did */
333 if (ho->neg_vj && ho->old_vj) {
336 go->vj_protocol = ho->vj_protocol;
341 ADDCIADDR((go->old_addrs? CI_ADDRS: CI_ADDR), go->neg_addr,
342 go->old_addrs, go->ouraddr, go->hisaddr);
344 ADDCIVJ(CI_COMPRESSTYPE, go->neg_vj, go->vj_protocol, go->old_vj,
345 go->maxslotindex, go->cflag);
352 * ipcp_ackci - Ack our CIs.
359 ipcp_ackci(f, p, len)
364 ipcp_options *go = &ipcp_gotoptions[f->unit];
365 u_short cilen, citype, cishort;
367 u_char cimaxslotindex, cicflag;
370 * CIs must be in exactly the same order that we sent...
371 * Check packet length and CI length at each step.
372 * If we find any deviations, then this packet is bad.
375 #define ACKCIVJ(opt, neg, val, old, maxslotindex, cflag) \
377 int vjlen = old? CILEN_COMPRESS : CILEN_VJ; \
378 if ((len -= vjlen) < 0) \
380 GETCHAR(citype, p); \
382 if (cilen != vjlen || \
385 GETSHORT(cishort, p); \
386 if (cishort != val) \
389 GETCHAR(cimaxslotindex, p); \
390 if (cimaxslotindex != maxslotindex) \
392 GETCHAR(cicflag, p); \
393 if (cicflag != cflag) \
398 #define ACKCIADDR(opt, neg, old, val1, val2) \
400 int addrlen = (old? CILEN_ADDRS: CILEN_ADDR); \
402 if ((len -= addrlen) < 0) \
404 GETCHAR(citype, p); \
406 if (cilen != addrlen || \
411 if (val1 != cilong) \
416 if (val2 != cilong) \
421 ACKCIADDR((go->old_addrs? CI_ADDRS: CI_ADDR), go->neg_addr,
422 go->old_addrs, go->ouraddr, go->hisaddr);
424 ACKCIVJ(CI_COMPRESSTYPE, go->neg_vj, go->vj_protocol, go->old_vj,
425 go->maxslotindex, go->cflag);
428 * If there are any remaining CIs, then this packet is bad.
435 IPCPDEBUG((LOG_INFO, "ipcp_ackci: received bad Ack!"));
440 * ipcp_nakci - Peer has sent a NAK for some of our CIs.
441 * This should not modify any state if the Nak is bad
442 * or if IPCP is in the OPENED state.
449 ipcp_nakci(f, p, len)
454 ipcp_options *go = &ipcp_gotoptions[f->unit];
455 u_char cimaxslotindex, cicflag;
456 u_char citype, cilen, *next;
458 u_long ciaddr1, ciaddr2, l;
459 ipcp_options no; /* options we've seen Naks for */
460 ipcp_options try; /* options to request next time */
462 BZERO(&no, sizeof(no));
466 * Any Nak'd CIs must be in exactly the same order that we sent.
467 * Check packet length and CI length at each step.
468 * If we find any deviations, then this packet is bad.
470 #define NAKCIADDR(opt, neg, old, code) \
472 len >= (cilen = (old? CILEN_ADDRS: CILEN_ADDR)) && \
478 ciaddr1 = htonl(l); \
481 ciaddr2 = htonl(l); \
489 #define NAKCIVJ(opt, neg, code) \
491 ((cilen = p[1]) == CILEN_COMPRESS || cilen == CILEN_VJ) && \
496 GETSHORT(cishort, p); \
497 if (cilen == CILEN_VJ) { \
498 GETCHAR(cimaxslotindex, p); \
499 GETCHAR(cicflag, p); \
506 * Accept the peer's idea of {our,his} address, if different
507 * from our idea, only if the accept_{local,remote} flag is set.
509 NAKCIADDR(CI_ADDR, neg_addr, go->old_addrs,
510 if (go->accept_local && ciaddr1) { /* Do we know our address? */
511 try.ouraddr = ciaddr1;
512 IPCPDEBUG((LOG_INFO, "local IP address %s",
515 if (go->accept_remote && ciaddr2) { /* Does he know his? */
516 try.hisaddr = ciaddr2;
517 IPCPDEBUG((LOG_INFO, "remote IP address %s",
523 * Accept the peer's value of maxslotindex provided that it
524 * is less than what we asked for. Turn off slot-ID compression
525 * if the peer wants. Send old-style compress-type option if
528 NAKCIVJ(CI_COMPRESSTYPE, neg_vj,
529 if (cilen == CILEN_VJ) {
530 if (cishort == IPCP_VJ_COMP) {
532 if (cimaxslotindex < go->maxslotindex)
533 try.maxslotindex = cimaxslotindex;
540 if (cishort == IPCP_VJ_COMP || cishort == IPCP_VJ_COMP_OLD) {
542 try.vj_protocol = cishort;
550 * There may be remaining CIs, if the peer is requesting negotiation
551 * on an option that we didn't include in our request packet.
552 * If they want to negotiate about IP addresses, we comply.
553 * If they want us to ask for compression, we refuse.
555 while (len > CILEN_VOID) {
558 if( (len -= cilen) < 0 )
560 next = p + cilen - 2;
563 case CI_COMPRESSTYPE:
564 if (go->neg_vj || no.neg_vj ||
565 (cilen != CILEN_VJ && cilen != CILEN_COMPRESS))
570 if (go->neg_addr && go->old_addrs || no.old_addrs
571 || cilen != CILEN_ADDRS)
577 if (ciaddr1 && go->accept_local)
578 try.ouraddr = ciaddr1;
581 if (ciaddr2 && go->accept_remote)
582 try.hisaddr = ciaddr2;
586 if (go->neg_addr || no.neg_addr || cilen != CILEN_ADDR)
592 if (ciaddr1 && go->accept_local)
593 try.ouraddr = ciaddr1;
602 /* If there is still anything left, this packet is bad. */
607 * OK, the Nak is good. Now we can update state.
609 if (f->state != OPENED)
615 IPCPDEBUG((LOG_INFO, "ipcp_nakci: received bad Nak!"));
621 * ipcp_rejci - Reject some of our CIs.
624 ipcp_rejci(f, p, len)
629 ipcp_options *go = &ipcp_gotoptions[f->unit];
630 u_char cimaxslotindex, ciflag, cilen;
633 ipcp_options try; /* options to request next time */
637 * Any Rejected CIs must be in exactly the same order that we sent.
638 * Check packet length and CI length at each step.
639 * If we find any deviations, then this packet is bad.
641 #define REJCIADDR(opt, neg, old, val1, val2) \
643 len >= (cilen = old? CILEN_ADDRS: CILEN_ADDR) && \
651 /* Check rejected value. */ \
652 if (cilong != val1) \
657 /* Check rejected value. */ \
658 if (cilong != val2) \
664 #define REJCIVJ(opt, neg, val, old, maxslot, cflag) \
666 p[1] == (old? CILEN_COMPRESS : CILEN_VJ) && \
671 GETSHORT(cishort, p); \
672 /* Check rejected value. */ \
673 if (cishort != val) \
676 GETCHAR(cimaxslotindex, p); \
677 if (cimaxslotindex != maxslot) \
679 GETCHAR(ciflag, p); \
680 if (ciflag != cflag) \
686 REJCIADDR((go->old_addrs? CI_ADDRS: CI_ADDR), neg_addr,
687 go->old_addrs, go->ouraddr, go->hisaddr);
689 REJCIVJ(CI_COMPRESSTYPE, neg_vj, go->vj_protocol, go->old_vj,
690 go->maxslotindex, go->cflag);
693 * If there are any remaining CIs, then this packet is bad.
698 * Now we can update state.
700 if (f->state != OPENED)
705 IPCPDEBUG((LOG_INFO, "ipcp_rejci: received bad Reject!"));
711 * ipcp_reqci - Check the peer's requested CIs and send appropriate response.
713 * Returns: CONFACK, CONFNAK or CONFREJ and input packet modified
714 * appropriately. If reject_if_disagree is non-zero, doesn't return
715 * CONFNAK; returns CONFREJ if it can't return CONFACK.
718 ipcp_reqci(f, inp, len, reject_if_disagree)
720 u_char *inp; /* Requested CIs */
721 int *len; /* Length of requested CIs */
722 int reject_if_disagree;
724 ipcp_options *wo = &ipcp_wantoptions[f->unit];
725 ipcp_options *ho = &ipcp_hisoptions[f->unit];
726 ipcp_options *ao = &ipcp_allowoptions[f->unit];
727 ipcp_options *go = &ipcp_gotoptions[f->unit];
728 u_char *cip, *next; /* Pointer to current and next CIs */
729 u_short cilen, citype; /* Parsed len, type */
730 u_short cishort; /* Parsed short value */
731 u_long tl, ciaddr1, ciaddr2;/* Parsed address values */
732 int rc = CONFACK; /* Final packet return code */
733 int orc; /* Individual option return code */
734 u_char *p; /* Pointer to next char to parse */
735 u_char *ucp = inp; /* Pointer to current output char */
736 int l = *len; /* Length left */
737 u_char maxslotindex, cflag;
740 * Reset all his options.
742 BZERO(ho, sizeof(*ho));
745 * Process all his options.
749 orc = CONFACK; /* Assume success */
750 cip = p = next; /* Remember begining of CI */
751 if (l < 2 || /* Not enough data for CI header or */
752 p[1] < 2 || /* CI length too small or */
753 p[1] > l) { /* CI length too big? */
754 IPCPDEBUG((LOG_INFO, "ipcp_reqci: bad CI length!"));
755 orc = CONFREJ; /* Reject bad CI */
756 cilen = l; /* Reject till end of packet */
757 l = 0; /* Don't loop again */
760 GETCHAR(citype, p); /* Parse CI type */
761 GETCHAR(cilen, p); /* Parse CI length */
762 l -= cilen; /* Adjust remaining length */
763 next += cilen; /* Step to next CI */
765 switch (citype) { /* Check CI type */
767 IPCPDEBUG((LOG_INFO, "ipcp: received ADDRS "));
769 cilen != CILEN_ADDRS) { /* Check CI length */
770 orc = CONFREJ; /* Reject CI */
775 * If he has no address, or if we both have his address but
776 * disagree about it, then NAK it with our idea.
777 * In particular, if we don't know his address, but he does,
780 GETLONG(tl, p); /* Parse source address (his) */
782 IPCPDEBUG((LOG_INFO, "(%s:", ip_ntoa(ciaddr1)));
783 if (ciaddr1 != wo->hisaddr
784 && (ciaddr1 == 0 || !wo->accept_remote)) {
786 if (!reject_if_disagree) {
787 DECPTR(sizeof (long), p);
788 tl = ntohl(wo->hisaddr);
794 * If he doesn't know our address, or if we both have our address
795 * but disagree about it, then NAK it with our idea.
797 GETLONG(tl, p); /* Parse desination address (ours) */
799 IPCPDEBUG((LOG_INFO, "%s)", ip_ntoa(ciaddr2)));
800 if (ciaddr2 != wo->ouraddr) {
801 if (ciaddr2 == 0 || !wo->accept_local) {
803 if (!reject_if_disagree) {
804 DECPTR(sizeof (long), p);
805 tl = ntohl(wo->ouraddr);
809 go->ouraddr = ciaddr2; /* accept peer's idea */
815 ho->hisaddr = ciaddr1;
816 ho->ouraddr = ciaddr2;
820 IPCPDEBUG((LOG_INFO, "ipcp: received ADDR "));
823 cilen != CILEN_ADDR) { /* Check CI length */
824 orc = CONFREJ; /* Reject CI */
829 * If he has no address, or if we both have his address but
830 * disagree about it, then NAK it with our idea.
831 * In particular, if we don't know his address, but he does,
834 GETLONG(tl, p); /* Parse source address (his) */
836 IPCPDEBUG((LOG_INFO, "(%s)", ip_ntoa(ciaddr1)));
837 if (ciaddr1 != wo->hisaddr
838 && (ciaddr1 == 0 || !wo->accept_remote)) {
840 if (!reject_if_disagree) {
841 DECPTR(sizeof (long), p);
842 tl = ntohl(wo->hisaddr);
848 ho->hisaddr = ciaddr1;
851 case CI_COMPRESSTYPE:
852 IPCPDEBUG((LOG_INFO, "ipcp: received COMPRESSTYPE "));
854 (cilen != CILEN_VJ && cilen != CILEN_COMPRESS)) {
858 GETSHORT(cishort, p);
859 IPCPDEBUG((LOG_INFO, "(%d)", cishort));
861 if (!(cishort == IPCP_VJ_COMP ||
862 (cishort == IPCP_VJ_COMP_OLD && cilen == CILEN_COMPRESS))) {
868 ho->vj_protocol = cishort;
869 if (cilen == CILEN_VJ) {
870 GETCHAR(maxslotindex, p);
871 if (maxslotindex > ao->maxslotindex) {
873 if (!reject_if_disagree){
875 PUTCHAR(ao->maxslotindex, p);
879 if (cflag && !ao->cflag) {
881 if (!reject_if_disagree){
883 PUTCHAR(wo->cflag, p);
886 ho->maxslotindex = maxslotindex;
887 ho->cflag = wo->cflag;
897 IPCPDEBUG((LOG_INFO, " (%s)\n", CODENAME(orc)));
899 if (orc == CONFACK && /* Good CI */
900 rc != CONFACK) /* but prior CI wasnt? */
901 continue; /* Don't send this one */
903 if (orc == CONFNAK) { /* Nak this CI? */
904 if (reject_if_disagree) /* Getting fed up with sending NAKs? */
905 orc = CONFREJ; /* Get tough if so */
907 if (rc == CONFREJ) /* Rejecting prior CI? */
908 continue; /* Don't send this one */
909 if (rc == CONFACK) { /* Ack'd all prior CIs? */
910 rc = CONFNAK; /* Not anymore... */
911 ucp = inp; /* Backup */
916 if (orc == CONFREJ && /* Reject this CI */
917 rc != CONFREJ) { /* but no prior ones? */
919 ucp = inp; /* Backup */
922 /* Need to move CI? */
924 BCOPY(cip, ucp, cilen); /* Move it */
926 /* Update output pointer */
931 * If we aren't rejecting this packet, and we want to negotiate
932 * their address, and they didn't send their address, then we
933 * send a NAK with a CI_ADDR option appended. We assume the
934 * input buffer is long enough that we can append the extra
937 if (rc != CONFREJ && !ho->neg_addr &&
938 wo->req_addr && !reject_if_disagree) {
941 ucp = inp; /* reset pointer */
942 wo->req_addr = 0; /* don't ask again */
944 PUTCHAR(CI_ADDR, ucp);
945 PUTCHAR(CILEN_ADDR, ucp);
946 tl = ntohl(wo->hisaddr);
950 *len = ucp - inp; /* Compute output length */
951 IPCPDEBUG((LOG_INFO, "ipcp: returning Configure-%s", CODENAME(rc)));
952 return (rc); /* Return final code */
957 * ipcp_up - IPCP has come UP.
959 * Configure the IP network interface appropriately and bring it up.
966 ipcp_options *ho = &ipcp_hisoptions[f->unit];
967 ipcp_options *go = &ipcp_gotoptions[f->unit];
969 IPCPDEBUG((LOG_INFO, "ipcp: up"));
970 go->default_route = 0;
974 * We must have a non-zero IP address for both ends of the link.
977 ho->hisaddr = ipcp_wantoptions[f->unit].hisaddr;
979 if (ho->hisaddr == 0) {
980 syslog(LOG_ERR, "Could not determine remote IP address");
984 if (go->ouraddr == 0) {
985 syslog(LOG_ERR, "Could not determine local IP address");
991 * Check that the peer is allowed to use the IP address he wants.
993 if (!auth_ip_addr(f->unit, ho->hisaddr)) {
994 syslog(LOG_ERR, "Peer is not authorized to use remote address %s",
995 ip_ntoa(ho->hisaddr));
1000 syslog(LOG_NOTICE, "local IP address %s", ip_ntoa(go->ouraddr));
1001 syslog(LOG_NOTICE, "remote IP address %s", ip_ntoa(ho->hisaddr));
1004 * Set IP addresses and (if specified) netmask.
1006 mask = GetMask(go->ouraddr);
1007 if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask)) {
1008 IPCPDEBUG((LOG_WARNING, "sifaddr failed"));
1009 ipcp_close(f->unit);
1013 /* set tcp compression */
1014 sifvjcomp(f->unit, ho->neg_vj, ho->cflag);
1016 /* bring the interface up for IP */
1017 if (!sifup(f->unit)) {
1018 IPCPDEBUG((LOG_WARNING, "sifup failed"));
1019 ipcp_close(f->unit);
1023 /* assign a default route through the interface if required */
1024 if (ipcp_wantoptions[f->unit].default_route)
1025 if (sifdefaultroute(f->unit, ho->hisaddr))
1026 go->default_route = 1;
1028 /* Make a proxy ARP entry if requested. */
1029 if (ipcp_wantoptions[f->unit].proxy_arp)
1030 if (sifproxyarp(f->unit, ho->hisaddr))
1036 * ipcp_down - IPCP has gone DOWN.
1038 * Take the IP network interface down, clear its addresses
1039 * and delete routes through it.
1045 u_long ouraddr, hisaddr;
1047 IPCPDEBUG((LOG_INFO, "ipcp: down"));
1049 ouraddr = ipcp_gotoptions[f->unit].ouraddr;
1050 hisaddr = ipcp_hisoptions[f->unit].hisaddr;
1051 if (ipcp_gotoptions[f->unit].proxy_arp)
1052 cifproxyarp(f->unit, hisaddr);
1053 if (ipcp_gotoptions[f->unit].default_route)
1054 cifdefaultroute(f->unit, hisaddr);
1056 cifaddr(f->unit, ouraddr, hisaddr);