]> git.ozlabs.org Git - ppp.git/commitdiff
Changing INET6 to PPP_WITH_IPV6CP and adding configure option
authorEivind Næss <eivnaes@yahoo.com>
Fri, 6 Aug 2021 16:14:02 +0000 (09:14 -0700)
committerEivind Næss <eivnaes@yahoo.com>
Fri, 15 Jul 2022 22:25:38 +0000 (15:25 -0700)
Based on feedback on PR #296, the option ipv6-support seems inconsistent
with the existing ipxcp option. Futhermore, the #define has been renamed
to avoid bleeding into third party projects.

pppdconf.h is already distributed and will define or undefine the
PPP_WITH_IPV6CP define.

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
configure.ac
pppd/Makefile.am
pppd/eui64.h
pppd/main.c
pppd/options.c
pppd/pathnames.h
pppd/pppd.h
pppd/pppdconf.h.in
pppd/sys-linux.c
pppd/sys-solaris.c

index dd22dc65ee3d66aef39220097c6d90cfb160fa91..85688a8300fee286a6160dcfbf5e1275d6760eb3 100644 (file)
@@ -143,11 +143,11 @@ AS_IF([test "x${enable_mslanman}" = "xyes" && test "x${enable_microsoft_extensio
 
 #
 # Disable IPv6 support
-AC_ARG_ENABLE([ipv6-support],
-    AS_HELP_STRING([--disable-ipv6-support], [Disable IPv6 support]))
-AM_CONDITIONAL(WITH_INET6, test "x${enable_ipv6_support}" != "xno")
-AM_COND_IF([WITH_INET6],
-    AC_DEFINE(INET6, 1, ["Have IPv6 support"]))
+AC_ARG_ENABLE([ipv6cp],
+    AS_HELP_STRING([--disable-ipv6cp], [Disable IPv6 Control Protocol]))
+AM_CONDITIONAL(PPP_WITH_IPV6CP, test "x${enable_ipv6cp}" != "xno")
+AM_COND_IF([PPP_WITH_IPV6CP],
+    AC_DEFINE(PPP_WITH_IPV6CP, 1, ["Have IPv6 Control Protocol"]))
 
 #
 # Disable Multilink support
@@ -410,6 +410,7 @@ Features enabled
     Multilink............: ${enable_multilink:-no}
     Plugins..............: ${enable_plugins:-yes}
     CBCP.................: ${enable_cbcp:-no}
+    IPV6CP...............: ${enable_ipv6cp:-yes}
     EAP-TLS..............: ${enable_eaptls:-yes}
     PEAP.................: ${enable_peap:-yes}
 "
index 97edd3ce8f7f346bb39d051ba30867b6d4b12bf4..bc9a6d95b97746879eeaf8077f6819c4c7be5419 100644 (file)
@@ -123,7 +123,7 @@ if WITH_TDB
 pppd_SOURCES += tdb.c spinlock.c
 endif
 
-if WITH_INET6
+if PPP_WITH_IPV6CP
 pppd_SOURCES += ipv6cp.c eui64.c
 endif
 
index aa83e1a092b8abf28a31eb14fd85c1e5dba3eea5..496814d17b3b4557725da8d85b4cf4a30efcaf80 100644 (file)
@@ -39,9 +39,9 @@
 #ifndef __EUI64_H__
 #define __EUI64_H__
 
-#if !defined(INET6)
-#error "this file should only be included when INET6 is defined"
-#endif /* not defined(INET6) */
+#if !defined(PPP_WITH_IPV6CP)
+#error "this file should only be included when PPP_WITH_IPV6CP is defined"
+#endif /* not defined(PPP_WITH_IPV6CP) */
 
 #if defined(SOL2)
 #include <netinet/in.h>
index 23294379119867d73d9dbe774f20170d945e0631..cba4a925a58b82ff5a471a5b2acf563fcdefa05c 100644 (file)
@@ -91,6 +91,7 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include <limits.h>
 #include <inttypes.h>
 
 #include "pppd.h"
@@ -98,7 +99,7 @@
 #include "fsm.h"
 #include "lcp.h"
 #include "ipcp.h"
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
 #include "ipv6cp.h"
 #endif
 #include "upap.h"
@@ -271,7 +272,7 @@ struct protent *protocols[] = {
     &cbcp_protent,
 #endif
     &ipcp_protent,
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
     &ipv6cp_protent,
 #endif
     &ccp_protent,
@@ -295,9 +296,9 @@ main(int argc, char *argv[])
     strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup));
     strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown));
 
-#ifdef INET6
-    strlcpy(path_ipv6up, _PATH_IPV6UP, sizeof(path_ipv6up));
-    strlcpy(path_ipv6down, _PATH_IPV6DOWN, sizeof(path_ipv6down));
+#ifdef PPP_WITH_IPV6CP
+    strlcpy(path_ipv6up, _PATH_IPV6UP, MAXPATHLEN);
+    strlcpy(path_ipv6down, _PATH_IPV6DOWN, MAXPATHLEN);
 #endif
     link_stats_valid = 0;
     new_phase(PHASE_INITIALIZE);
index d4906c9506239101c4556a3239817aab0d7a2006..ffd9015b2813b622315761a7a2545be8326fb323 100644 (file)
@@ -131,7 +131,7 @@ int child_wait = 5;         /* # seconds to wait for children at exit */
 struct userenv *userenv_list;  /* user environment variables */
 int    dfl_route_metric = -1;  /* metric of the default route to set over the PPP link */
 
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
 char   path_ipv6up[MAXPATHLEN];   /* pathname of ipv6-up script */
 char   path_ipv6down[MAXPATHLEN]; /* pathname of ipv6-down script */
 #endif
@@ -335,7 +335,7 @@ option_t general_options[] = {
       "Set pathname of ip-down script",
       OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
 
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
     { "ipv6-up-script", o_string, path_ipv6up,
       "Set pathname of ipv6-up script",
       OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
index 915db67a0b8f5d32314df297c89fc2afbbed8ebb..c14402bfcc14961a17d1b65d54e97bf165ed8504 100644 (file)
@@ -59,7 +59,7 @@
 #define _PATH_USEROPT   ".ppprc"
 #define        _PATH_PSEUDONYM  ".ppp_pseudonym"
 
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
 #define _PATH_IPV6UP     _ROOT_PATH "/etc/ppp/ipv6-up"
 #define _PATH_IPV6DOWN   _ROOT_PATH "/etc/ppp/ipv6-down"
 #endif
index e54a526e57f36eb2ac8b1b89088f1b681688f607..5a6d75da62287b10a561ec8cba15b07134da7bfc 100644 (file)
 #include <unistd.h>            /* for setkey */
 #include <stdarg.h>
 #include <stdint.h>
-#include <limits.h>            /* for NGROUPS_MAX */
-#include <sys/param.h>         /* for MAXPATHLEN and BSD4_4, if defined */
 #include <sys/types.h>         /* for u_int32_t, if defined */
 #include <sys/time.h>          /* for struct timeval */
 #include <net/ppp_defs.h>
 #include <net/if.h>
 #include "patchlevel.h"
 
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
 #include "eui64.h"
 #endif
 
@@ -337,9 +335,9 @@ extern bool dump_options;   /* print out option values */
 extern bool    dryrun;         /* check everything, print options, exit */
 extern int     child_wait;     /* # seconds to wait for children at end */
 
-#ifdef INET6
-extern char    path_ipv6up[MAXPATHLEN]; /* pathname of ipv6-up script */
-extern char    path_ipv6down[MAXPATHLEN]; /* pathname of ipv6-down script */
+#ifdef PPP_WITH_IPV6CP
+extern char    path_ipv6up[]; /* pathname of ipv6-up script */
+extern char    path_ipv6down[]; /* pathname of ipv6-down script */
 #endif
 
 #if defined(USE_EAPTLS) || defined(USE_PEAP)
@@ -693,7 +691,7 @@ int  sifaddr(int, u_int32_t, u_int32_t, u_int32_t);
                                /* Configure IPv4 addresses for i/f */
 int  cifaddr(int, u_int32_t, u_int32_t);
                                /* Reset i/f IP addresses */
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
 int  sif6up(int);              /* Configure i/f up for IPv6 */
 int  sif6down(int);    /* Configure i/f down for IPv6 */
 int  sif6addr(int, eui64_t, eui64_t);
@@ -705,7 +703,7 @@ int  sifdefaultroute(int, u_int32_t, u_int32_t, bool replace_default_rt);
                                /* Create default route through i/f */
 int  cifdefaultroute(int, u_int32_t, u_int32_t);
                                /* Delete default route through i/f */
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
 int  sif6defaultroute(int, eui64_t, eui64_t);
                                /* Create default IPv6 route through i/f */
 int  cif6defaultroute(int, eui64_t, eui64_t);
index 9c0dacbb28fee9fd3b0048daf2d86d2a54f45207..63b61ee732fc6e3522df4e46938d58b5d9044688 100644 (file)
@@ -28,7 +28,7 @@
 #undef USE_TDB
 
 /* "Have IPv6 support" */
-#undef INET6
+#undef PPP_WITH_IPV6CP
 
 /* "Support for Pluggable Authentication Modules" */
 #undef USE_PAM
index 0ffc4277b2aa4b661fae8faac27ca450596f6599..94e5a19ed4c67cc44f97b2257c3b0d57b4ed15a0 100644 (file)
 #include <linux/ppp_defs.h>
 #include <linux/if_ppp.h>
 
+#ifdef PPP_WITH_IPV6CP
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 #include <linux/if_link.h>
 #define RTM_NEWSTATS 92
 #define RTM_GETSTATS 94
 #define IFLA_STATS_LINK_64 1
-#endif
+#endif /* PPP_WITH_IPV6CP */
 
-#ifdef INET6
 #include <linux/if_addr.h>
 /* glibc versions prior to 2.24 do not define SOL_NETLINK */
 #ifndef SOL_NETLINK
 #define SOL_NETLINK 270
 #endif
+
 /* linux kernel versions prior to 4.3 do not define/support NETLINK_CAP_ACK */
 #ifndef NETLINK_CAP_ACK
 #define NETLINK_CAP_ACK 10
  */
 #include "termios_linux.h"
 
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
 #ifndef _LINUX_IN6_H
 /*
  *    This is in linux/include/net/ipv6.h.
@@ -191,7 +192,7 @@ struct in6_ifreq {
        } while (0)
 
 static const eui64_t nulleui64;
-#endif /* INET6 */
+#endif /* PPP_WITH_IPV6CP */
 
 /* We can get an EIO error on an ioctl if the modem has hung up */
 #define ok_error(num) ((num)==EIO)
@@ -203,9 +204,9 @@ static int ppp_fd = -1;             /* fd which is set to PPP discipline */
 static int sock_fd = -1;       /* socket for doing interface ioctls */
 static int slave_fd = -1;      /* pty for old-style demand mode, slave */
 static int master_fd = -1;     /* pty for old-style demand mode, master */
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
 static int sock6_fd = -1;
-#endif /* INET6 */
+#endif /* PPP_WITH_IPV6CP */
 
 /*
  * For the old-style kernel driver, this is the same as ppp_fd.
@@ -348,7 +349,7 @@ void sys_init(void)
     if (sock_fd < 0)
        fatal("Couldn't create IP socket: %m(%d)", errno);
 
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
     sock6_fd = socket(AF_INET6, SOCK_DGRAM, 0);
     if (sock6_fd < 0)
        sock6_fd = -errno;      /* save errno for later */
@@ -374,15 +375,17 @@ void sys_cleanup(void)
        if_is_up = 0;
        sifdown(0);
     }
+#ifdef PPP_WITH_IPV6CP
     if (if6_is_up)
        sif6down(0);
+#endif
 
 /*
  * Delete any routes through the device.
  */
     if (have_default_route)
        cifdefaultroute(0, 0, 0);
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
     if (have_default_route6)
        cif6defaultroute(0, nulleui64, nulleui64);
 #endif
@@ -402,7 +405,7 @@ sys_close(void)
        close(ppp_dev_fd);
     if (sock_fd >= 0)
        close(sock_fd);
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
     if (sock6_fd >= 0)
        close(sock6_fd);
 #endif
@@ -2103,7 +2106,7 @@ int cifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway)
     return 1;
 }
 
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
 /*
  * /proc/net/ipv6_route parsing stuff.
  */
@@ -2293,7 +2296,7 @@ int cif6defaultroute (int unit, eui64_t ouraddr, eui64_t gateway)
 
     return 1;
 }
-#endif /* INET6 */
+#endif /* PPP_WITH_IPV6CP */
 
 /********************************************************************
  *
@@ -2919,15 +2922,15 @@ int sifdown (int u)
     if (if_is_up && --if_is_up > 0)
        return 1;
 
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
     if (if6_is_up)
        return 1;
-#endif /* INET6 */
+#endif /* PPP_WITH_IPV6CP */
 
     return setifstate(u, 0);
 }
 
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
 /********************************************************************
  *
  * sif6up - Config the interface up for IPv6
@@ -2958,7 +2961,7 @@ int sif6down (int u)
 
     return setifstate(u, 0);
 }
-#endif /* INET6 */
+#endif /* PPP_WITH_IPV6CP */
 
 /********************************************************************
  *
@@ -3146,7 +3149,7 @@ int cifaddr (int unit, u_int32_t our_adr, u_int32_t his_adr)
     return 1;
 }
 
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
 /********************************************************************
  *
  * sif6addr_rtnetlink - Config the interface with both IPv6 link-local addresses via rtnetlink
@@ -3407,7 +3410,7 @@ int cif6addr (int unit, eui64_t our_eui64, eui64_t his_eui64)
     }
     return 1;
 }
-#endif /* INET6 */
+#endif /* PPP_WITH_IPV6CP */
 
 /*
  * get_pty - get a pty master/slave pair and chown the slave side
index 809b506a3640d34879fd8d9be303912bc81b5caa..8ba5ec1bf198027bdfd17932a296204a5dae53dd 100644 (file)
@@ -190,7 +190,7 @@ static int  fdmuxid = -1;
 static int     ipfd;
 static int     ipmuxid = -1;
 
-#if defined(INET6) && defined(SOL2)
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
 static int     ip6fd;          /* IP file descriptor */
 static int     ip6muxid = -1;  /* Multiplexer file descriptor */
 static int     if6_is_up = 0;  /* IPv6 interface has been marked up */
@@ -224,11 +224,11 @@ static int        if6_is_up = 0;  /* IPv6 interface has been marked up */
 #define IN6A_LLADDR_FROM_EUI64(s, eui64)  \
     _IN6A_LLX_FROM_EUI64(s, eui64, 0xfe800000)
 
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
 
-#if !defined(INET6) || !defined(SOL2)
+#if !defined(PPP_WITH_IPV6CP) || !defined(SOL2)
 #define MAXIFS         256                     /* Max # of interfaces */
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
 
 static int     restore_term;
 static struct termios inittermios;
@@ -297,7 +297,7 @@ sifppa(fd, ppa)
 }
 #endif /* SOL2 */
 
-#if defined(SOL2) && defined(INET6)
+#if defined(SOL2) && defined(PPP_WITH_IPV6CP)
 /*
  * get_first_ether_hwaddr - get the hardware address for the first
  * ethernet-style interface on this system.
@@ -477,7 +477,7 @@ get_first_ether_hwaddr(u_char *addr)
     else
        return -1;
 }
-#endif /* defined(SOL2) && defined(INET6) */
+#endif /* defined(SOL2) && defined(PPP_WITH_IPV6CP) */
 
 #if defined(SOL2)
 /*
@@ -506,7 +506,7 @@ get_if_hwaddr(u_char *addr, char *if_name)
 }
 #endif /* SOL2 */
 
-#if defined(SOL2) && defined(INET6)
+#if defined(SOL2) && defined(PPP_WITH_IPV6CP)
 /*
  * slifname - Sets interface ppa and flags
  *
@@ -536,7 +536,7 @@ slifname_done:
 
 
 }
-#endif /* defined(SOL2) && defined(INET6) */
+#endif /* defined(SOL2) && defined(PPP_WITH_IPV6CP) */
 
 /*
  * sys_init - System-dependent initialization.
@@ -546,10 +546,10 @@ sys_init(void)
 {
     int ifd, x;
     struct ifreq ifr;
-#if defined(INET6) && defined(SOL2)
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
     int i6fd;
     struct lifreq lifr;
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
 #if !defined(SOL2)
     struct {
        union DL_primitives prim;
@@ -561,11 +561,11 @@ sys_init(void)
     if (ipfd < 0)
        fatal("Couldn't open IP device: %m");
 
-#if defined(INET6) && defined(SOL2)
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
     ip6fd = open(UDP6_DEV_NAME, O_RDWR, 0);
     if (ip6fd < 0)
        fatal("Couldn't open IP device (2): %m");
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
 
     if (default_device && !notty)
        tty_sid = getsid((pid_t)0);
@@ -604,7 +604,7 @@ sys_init(void)
        strioctl(ifd, PPPIO_DEBUG, &x, sizeof(int), 0);
     }
 
-#if defined(INET6) && defined(SOL2)
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
     i6fd = open(PPP_DEV_NAME, O_RDWR, 0);
     if (i6fd < 0) {
        close(ifd);
@@ -614,14 +614,14 @@ sys_init(void)
        x = PPPDBG_LOG + PPPDBG_DRIVER;
        strioctl(i6fd, PPPIO_DEBUG, &x, sizeof(int), 0);
     }
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
 
 #if defined(SOL2)
     if (ioctl(ifd, I_PUSH, IP_MOD_NAME) < 0) {
        close(ifd);
-#if defined(INET6)
+#if defined(PPP_WITH_IPV6CP)
        close(i6fd);
-#endif /* defined(INET6) */
+#endif /* defined(PPP_WITH_IPV6CP) */
        fatal("Can't push IP module: %m");
     }
 
@@ -631,13 +631,13 @@ sys_init(void)
      */
     if (sifppa(ifd, ifunit) < 0) {
         close (ifd);
-#if defined(INET6)
+#if defined(PPP_WITH_IPV6CP)
        close(i6fd);
-#endif /* defined(INET6) */
+#endif /* defined(PPP_WITH_IPV6CP) */
         fatal("Can't set ppa for unit %d: %m", ifunit);
     }
 
-#if defined(INET6)
+#if defined(PPP_WITH_IPV6CP)
     /*
      * An IPv6 interface is created anyway, even when the user does not 
      * explicitly enable it. Note that the interface will be marked
@@ -659,14 +659,14 @@ sys_init(void)
        close(i6fd);
        fatal("Can't set ifname for unit %d: %m", ifunit);
     }
-#endif /* defined(INET6) */
+#endif /* defined(PPP_WITH_IPV6CP) */
 
     ipmuxid = ioctl(ipfd, I_PLINK, ifd);
     close(ifd);
     if (ipmuxid < 0) {
-#if defined(INET6)
+#if defined(PPP_WITH_IPV6CP)
        close(i6fd);
-#endif /* defined(INET6) */
+#endif /* defined(PPP_WITH_IPV6CP) */
        fatal("Can't I_PLINK PPP device to IP: %m");
     }
 
@@ -683,9 +683,9 @@ sys_init(void)
      */
     if (ioctl(ipfd, SIOCSIFMUXID, &ifr) < 0) {
        ioctl(ipfd, I_PUNLINK, ipmuxid);
-#if defined(INET6)
+#if defined(PPP_WITH_IPV6CP)
        close(i6fd);
-#endif /* defined(INET6) */
+#endif /* defined(PPP_WITH_IPV6CP) */
        fatal("SIOCSIFMUXID: %m");
     }
 
@@ -703,7 +703,7 @@ sys_init(void)
        fatal("Can't link PPP device to IP: %m");
 #endif /* defined(SOL2) */
 
-#if defined(INET6) && defined(SOL2)
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
     ip6muxid = ioctl(ip6fd, I_PLINK, i6fd);
     close(i6fd);
     if (ip6muxid < 0) {
@@ -723,7 +723,7 @@ sys_init(void)
        ioctl(ip6fd, I_PUNLINK, ip6muxid);
        fatal("Can't link PPP device to IP (2): %m");
     }
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
 
 #if !defined(SOL2)
     /* Set the interface name for the link. */
@@ -746,15 +746,15 @@ sys_cleanup(void)
 {
 #if defined(SOL2)
     struct ifreq ifr;
-#if defined(INET6)
+#if defined(PPP_WITH_IPV6CP)
     struct lifreq lifr;
-#endif /* defined(INET6) */
+#endif /* defined(PPP_WITH_IPV6CP) */
 #endif /* defined(SOL2) */
 
-#if defined(SOL2) && defined(INET6)
+#if defined(SOL2) && defined(PPP_WITH_IPV6CP)
     if (if6_is_up)
        sif6down(0);
-#endif /* defined(SOL2) && defined(INET6) */
+#endif /* defined(SOL2) && defined(PPP_WITH_IPV6CP) */
     if (if_is_up)
        sifdown(0);
     if (default_route_gateway)
@@ -786,7 +786,7 @@ sys_cleanup(void)
        error("Can't I_PUNLINK PPP from IP: %m");
        return;
     }
-#if defined(INET6)
+#if defined(PPP_WITH_IPV6CP)
     /*
      * Make sure we ask ip what the muxid, because 'ifconfig modlist' will
      * unlink and re-link the modules, causing the muxid to change.
@@ -808,7 +808,7 @@ sys_cleanup(void)
     if (ioctl(ip6fd, I_PUNLINK, ip6muxid) < 0) {
        error("Can't I_PUNLINK PPP from IP (2): %m");
     }
-#endif /* defined(INET6) */
+#endif /* defined(PPP_WITH_IPV6CP) */
 #endif /* defined(SOL2) */
 }
 
@@ -819,9 +819,9 @@ void
 sys_close(void)
 {
     close(ipfd);
-#if defined(INET6) && defined(SOL2)
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
     close(ip6fd);
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
     if (pppfd >= 0)
        close(pppfd);
 }
@@ -1462,10 +1462,10 @@ void
 netif_set_mtu(int unit, int mtu)
 {
     struct ifreq ifr;
-#if defined(INET6) && defined(SOL2)
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
     struct lifreq lifr;
     int        fd;
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
 
     memset(&ifr, 0, sizeof(ifr));
     strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
@@ -1474,7 +1474,7 @@ netif_set_mtu(int unit, int mtu)
        error("Couldn't set IP MTU (%s): %m", ifr.ifr_name);
     }
 
-#if defined(INET6) && defined(SOL2) 
+#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
     fd = socket(AF_INET6, SOCK_DGRAM, 0);
     if (fd < 0)
        error("Couldn't open IPv6 socket: %m");
@@ -1487,7 +1487,7 @@ netif_set_mtu(int unit, int mtu)
        error("Couldn't set IPv6 MTU (%s): %m", ifr.ifr_name);
     }
     close(fd);
-#endif /* defined(INET6) && defined(SOL2) */
+#endif /* defined(PPP_WITH_IPV6CP) && defined(SOL2) */
 }
 
 
@@ -1754,7 +1754,7 @@ sifnpmode(int u, int proto, enum NPmode mode)
     return 1;
 }
 
-#if defined(SOL2) && defined(INET6)
+#if defined(SOL2) && defined(PPP_WITH_IPV6CP)
 /*
  * sif6up - Config the IPv6 interface up and enable IPv6 packets to pass.
  */
@@ -1938,7 +1938,7 @@ cif6defaultroute(int u, eui64_t l, eui64_t g)
     return 1;
 }
 
-#endif /* defined(SOL2) && defined(INET6) */
+#endif /* defined(SOL2) && defined(PPP_WITH_IPV6CP) */
 
 
 #define INET_ADDR(x)   (((struct sockaddr_in *) &(x))->sin_addr.s_addr)