X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fipv6cp.c;h=a80f222d908c203f0097354ba3a75c0a88b6fb00;hp=c5db5776dfbc3b08acb0093d1762fecb3dfb17ca;hb=f9eac6e29b5137c46063855b3bfc253159c90c29;hpb=fc8a2a1cb1a141e5c1d9c9f0580e4f97271f9734 diff --git a/pppd/ipv6cp.c b/pppd/ipv6cp.c index c5db577..a80f222 100644 --- a/pppd/ipv6cp.c +++ b/pppd/ipv6cp.c @@ -95,10 +95,10 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ipv6cp.c,v 1.5 1999/09/11 12:04:22 paulus Exp $ + * $Id: ipv6cp.c,v 1.9 2000/04/15 01:27:11 masputra Exp $ */ -#define RCSID "$Id: ipv6cp.c,v 1.5 1999/09/11 12:04:22 paulus Exp $" +#define RCSID "$Id: ipv6cp.c,v 1.9 2000/04/15 01:27:11 masputra Exp $" /* * TODO: @@ -179,7 +179,7 @@ static fsm_callbacks ipv6cp_callbacks = { /* IPV6CP callback routines */ static int setifaceid __P((char **arg)); static option_t ipv6cp_option_list[] = { - { "ipv6", o_special, setifaceid, + { "ipv6", o_special, (void *)setifaceid, "Set interface identifiers for IPV6" }, { "noipv6", o_bool, &ipv6cp_protent.enabled_flag, "Disable IPv6 and IPv6CP" }, @@ -192,7 +192,10 @@ static option_t ipv6cp_option_list[] = { "Accept peer's interface identifier for us", 1 }, { "ipv6cp-use-ipaddr", o_bool, &ipv6cp_allowoptions[0].use_ip, "Use (default) IPv4 address as interface identifier", 0 }, - +#if defined(SOL2) + { "ipv6cp-use-persistent", o_bool, &ipv6cp_wantoptions[0].use_persistent, + "Use uniquely-available persistent value for link local address", 1 }, +#endif /* defined(SOL2) */ { "ipv6cp-restart", o_int, &ipv6cp_fsm[0].timeouttime, "Set timeout for IPv6CP" }, { "ipv6cp-max-terminate", o_int, &ipv6cp_fsm[0].maxtermtransmits, @@ -913,14 +916,14 @@ ipv6cp_reqci(f, inp, len, reject_if_disagree) orc = CONFREJ; break; } -#else - orc = CONFREJ; - break; -#endif ho->neg_vj = 1; ho->vj_protocol = cishort; break; +#else + orc = CONFREJ; + break; +#endif default: orc = CONFREJ; @@ -995,6 +998,28 @@ ipv6_check_options() { ipv6cp_options *wo = &ipv6cp_wantoptions[0]; +#if defined(SOL2) + /* + * Persistent link-local id is only used when user has not explicitly + * configure/hard-code the id + */ + if ((wo->use_persistent) && (!wo->opt_local) && (!wo->opt_remote)) { + + /* + * On systems where there are no Ethernet interfaces used, there + * may be other ways to obtain a persistent id. Right now, it + * will fall back to using magic [see eui64_magic] below when + * an EUI-48 from MAC address can't be obtained. Other possibilities + * include obtaining EEPROM serial numbers, or some other unique + * yet persistent number. On Sparc platforms, this is possible, + * but too bad there's no standards yet for x86 machines. + */ + if (ether_to_eui64(&wo->ourid)) { + wo->opt_local = 1; + } + } +#endif + if (!wo->opt_local) { /* init interface identifier */ if (wo->use_ip && eui64_iszero(wo->ourid)) { eui64_setlo32(wo->ourid, ntohl(ipcp_wantoptions[0].ouraddr)); @@ -1031,9 +1056,14 @@ ipv6_demand_conf(u) { ipv6cp_options *wo = &ipv6cp_wantoptions[u]; -#if defined(__linux__) || (defined(SVR4) && (defined(SNI) || defined(__USLC__))) +#if defined(__linux__) || defined(SOL2) || (defined(SVR4) && (defined(SNI) || defined(__USLC__))) +#if defined(SOL2) + if (!sif6up(u)) + return 0; +#else if (!sifup(u)) return 0; +#endif /* defined(SOL2) */ #endif if (!sif6addr(u, wo->ourid, wo->hisid)) return 0; @@ -1090,8 +1120,8 @@ ipv6cp_up(f) return; } } - script_setenv("LLLOCAL", llv6_ntoa(go->ourid)); - script_setenv("LLREMOTE", llv6_ntoa(ho->hisid)); + script_setenv("LLLOCAL", llv6_ntoa(go->ourid), 0); + script_setenv("LLREMOTE", llv6_ntoa(ho->hisid), 0); #ifdef IPV6CP_COMP /* set tcp compression */ @@ -1130,7 +1160,7 @@ ipv6cp_up(f) /* * Set LL addresses */ -#if !defined(__linux__) && !(defined(SVR4) && (defined(SNI) || defined(__USLC__))) +#if !defined(__linux__) && !defined(SOL2) && !(defined(SVR4) && (defined(SNI) || defined(__USLC__))) if (!sif6addr(f->unit, go->ourid, ho->hisid)) { if (debug) warn("sif6addr failed"); @@ -1140,14 +1170,23 @@ ipv6cp_up(f) #endif /* bring the interface up for IPv6 */ +#if defined(SOL2) + if (!sif6up(f->unit)) { + if (debug) + warn("sifup failed (IPV6)"); + ipv6cp_close(f->unit, "Interface configuration failed"); + return; + } +#else if (!sifup(f->unit)) { if (debug) warn("sifup failed (IPV6)"); ipv6cp_close(f->unit, "Interface configuration failed"); return; } +#endif /* defined(SOL2) */ -#if defined(__linux__) || (defined(SVR4) && (defined(SNI) || defined(__USLC__))) +#if defined(__linux__) || defined(SOL2) || (defined(SVR4) && (defined(SNI) || defined(__USLC__))) if (!sif6addr(f->unit, go->ourid, ho->hisid)) { if (debug) warn("sif6addr failed"); @@ -1204,7 +1243,11 @@ ipv6cp_down(f) } else { sifnpmode(f->unit, PPP_IPV6, NPMODE_DROP); #if !defined(__linux__) && !(defined(SVR4) && (defined(SNI) || defined(__USLC))) +#if defined(SOL2) + sif6down(f->unit); +#else sifdown(f->unit); +#endif /* defined(SOL2) */ #endif ipv6cp_clear_addrs(f->unit, ipv6cp_gotoptions[f->unit].ourid, @@ -1380,7 +1423,7 @@ ipv6cp_printpkt(p, plen, printer, arg) case TERMREQ: if (len > 0 && *p >= ' ' && *p < 0x7f) { printer(arg, " "); - print_string(p, len, printer, arg); + print_string((char *)p, len, printer, arg); p += len; len = 0; }