From de8da14d845ee6db9236ccfddabf1d8ebf045ddb Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Sun, 9 Mar 2014 17:48:07 +1100 Subject: [PATCH] pppd: Eliminate some unnecessary ifdefs Since we only support Linux and Solaris these days, statements like: #if defined(SOL2) || defined(__linux__) are always true and can be removed, along with anything in the #else branch of such a #if, and anything within a #if with the inverse condition. Furthermore, inside a #if !defined(__linux__) we know that SOL2 must be defined. This simplifies the code along these lines. Signed-off-by: Paul Mackerras --- pppd/ipv6cp.c | 38 -------------------------------------- pppd/ipv6cp.h | 2 -- 2 files changed, 40 deletions(-) diff --git a/pppd/ipv6cp.c b/pppd/ipv6cp.c index 7e76073..356ff84 100644 --- a/pppd/ipv6cp.c +++ b/pppd/ipv6cp.c @@ -249,10 +249,8 @@ static option_t ipv6cp_option_list[] = { { "ipv6cp-use-ipaddr", o_bool, &ipv6cp_allowoptions[0].use_ip, "Use (default) IPv4 address as interface identifier", 1 }, -#if defined(SOL2) || defined(__linux__) { "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", OPT_PRIO }, @@ -1088,7 +1086,6 @@ ipv6_check_options() if (!ipv6cp_protent.enabled_flag) return; -#if defined(SOL2) || defined(__linux__) /* * Persistent link-local id is only used when user has not explicitly * configure/hard-code the id @@ -1108,7 +1105,6 @@ ipv6_check_options() wo->opt_local = 1; } } -#endif if (!wo->opt_local) { /* init interface identifier */ if (wo->use_ip && eui64_iszero(wo->ourid)) { @@ -1146,15 +1142,8 @@ ipv6_demand_conf(u) { ipv6cp_options *wo = &ipv6cp_wantoptions[u]; -#if defined(__linux__) || defined(SOL2) || (defined(SVR4) && (defined(SNI) || defined(__USLC__))) -#if defined(SOL2) || defined(__linux__) if (!sif6up(u)) return 0; -#else - if (!sifup(u)) - return 0; -#endif /* defined(SOL2) || defined(__linux__) */ -#endif if (!sif6addr(u, wo->ourid, wo->hisid)) return 0; #if !defined(__linux__) && !(defined(SVR4) && (defined(SNI) || defined(__USLC__))) @@ -1247,43 +1236,20 @@ ipv6cp_up(f) sifnpmode(f->unit, PPP_IPV6, NPMODE_PASS); } else { - /* - * Set LL addresses - */ -#if !defined(__linux__) && !defined(SOL2) && !(defined(SVR4) && (defined(SNI) || defined(__USLC__))) - if (!sif6addr(f->unit, go->ourid, ho->hisid)) { - if (debug) - warn("sif6addr failed"); - ipv6cp_close(f->unit, "Interface configuration failed"); - return; - } -#endif - /* bring the interface up for IPv6 */ -#if defined(SOL2) || defined(__linux__) if (!sif6up(f->unit)) { if (debug) warn("sif6up 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) || defined(__linux__) */ -#if defined(__linux__) || defined(SOL2) || (defined(SVR4) && (defined(SNI) || defined(__USLC__))) if (!sif6addr(f->unit, go->ourid, ho->hisid)) { if (debug) warn("sif6addr failed"); ipv6cp_close(f->unit, "Interface configuration failed"); return; } -#endif sifnpmode(f->unit, PPP_IPV6, NPMODE_PASS); notice("local LL address %s", llv6_ntoa(go->ourid)); @@ -1340,11 +1306,7 @@ 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, diff --git a/pppd/ipv6cp.h b/pppd/ipv6cp.h index cc4568d..2f4c06d 100644 --- a/pppd/ipv6cp.h +++ b/pppd/ipv6cp.h @@ -154,9 +154,7 @@ typedef struct ipv6cp_options { int opt_local; /* ourtoken set by option */ int opt_remote; /* histoken set by option */ int use_ip; /* use IP as interface identifier */ -#if defined(SOL2) || defined(__linux__) int use_persistent; /* use uniquely persistent value for address */ -#endif /* defined(SOL2) */ int neg_vj; /* Van Jacobson Compression? */ u_short vj_protocol; /* protocol value to use in VJ option */ eui64_t ourid, hisid; /* Interface identifiers */ -- 2.39.2