X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fipv6cp.c;h=98cae543fe29eb9d88658bb6c2ff12b9eee3c3e7;hp=e2055a445b32c77637008ed258462155511b2bb2;hb=3f2fe49d822135c209e9896f666b748cf2234f2e;hpb=10a68fd183c5e16e95fce56e7b292f1436b1e714 diff --git a/pppd/ipv6cp.c b/pppd/ipv6cp.c index e2055a4..98cae54 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.4 1999/08/25 04:15:51 paulus Exp $ + * $Id: ipv6cp.c,v 1.8 2000/04/04 07:06:50 paulus Exp $ */ -#define RCSID "$Id: ipv6cp.c,v 1.4 1999/08/25 04:15:51 paulus Exp $" +#define RCSID "$Id: ipv6cp.c,v 1.8 2000/04/04 07:06:50 paulus Exp $" /* * TODO: @@ -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, @@ -312,6 +315,7 @@ setifaceid(argv) wo->opt_remote = 1; } + ipv6cp_protent.enabled_flag = 1; return 1; } @@ -994,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)); @@ -1030,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; @@ -1089,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 */ @@ -1129,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"); @@ -1139,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"); @@ -1203,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,