sys-solaris.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* System-dependent procedures for pppd under Solaris 2.x (SunOS 5.x).
*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, provided that the above copyright
* notice appears in all copies.
*
* SUN MAKES NO REPRESENTATION OR WARRANTIES ABOUT THE SUITABILITY OF
* THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
* ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
* DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES
*
* Copyright (c) 1994 The Australian National University.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, provided that the above copyright
* notice appears in all copies. This software is provided without any
* warranty, express or implied. The Australian National University
* makes no representations about the suitability of this software for
* any purpose.
*
* IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
* PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
* THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
* OR MODIFICATIONS.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#define RCSID "$Id: sys-solaris.c,v 1.2 2000/04/21 01:27:57 masputra Exp $"
#include <limits.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <netdb.h>
#include <termios.h>
#include <signal.h>
#include <string.h>
#include <stropts.h>
#include <utmpx.h>
#include <sys/sysmacros.h>
#include <sys/systeminfo.h>
#include <net/ppp_defs.h>
#include <net/if_types.h>
#include <sys/ethernet.h>
#include <sys/ser_sync.h>
#include "pppd.h"
#include "fsm.h"
#include "lcp.h"
#include "ipcp.h"
#ifdef INET6
#include "ipv6cp.h"
#endif /* INET6 */
#include "ccp.h"
#endif
/* Need to use UDP for ifconfig compatibility */
#if !defined(UDP_DEV_NAME)
#define UDP_DEV_NAME "/dev/udp"
#endif /* UDP_DEV_NAME */
#if !defined(IP_DEV_NAME)
#define IP_DEV_NAME "/dev/ip"
#endif /* IP_DEV_NAME */
#if !defined(UDP6_DEV_NAME)
#define UDP6_DEV_NAME "/dev/udp6"
#endif /* UDP6_DEV_NAME */
#if !defined(IP6_DEV_NAME)
#define IP6_DEV_NAME "/dev/ip6"
#endif /* IP6_DEV_NAME */
#if !defined(IP_MOD_NAME)
#define IP_MOD_NAME "ip"
#endif /* IP_MOD_NAME */
#define MAX_POLLFDS 32
#define NMODULES 32
#ifndef LIFNAMSIZ
#define LIFNAMSIZ 32
#endif /* LIFNAMSIZ */
#ifndef MAXIFS
#define MAXIFS 256
#endif /* MAXIFS */
#ifndef ETHERADDRL
#define ETHERADDRL 6
#endif /* ETHERADDRL */
#ifdef INET6
s->sin6_family = AF_INET6, \
l.lifr_addrlen = len, \
/*
* Generate a link-local address with an interface-id based on the given
* EUI64 identifier. Note that the len field is unused by SIOCSLIFADDR.
*/
#define IN6_LLADDR_FROM_EUI64(l, s, eui64) \
/*
* Generate an EUI64 based interface-id for use by stateless address
* autoconfiguration. These are required to be 64 bits long as defined in
* the "Interface Identifiers" section of the IPv6 Addressing Architecture
* (RFC3513).
*/
#define IN6_LLTOKEN_FROM_EUI64(l, s, eui64) \
#endif /* INET6 */
#ifdef INET6
#endif /* INET6 */
/* For plug-in usage. */
bool already_ppp = 0; /* Already in PPP mode */
static bool if6_is_up = 0; /* IPv6 if marked as up */
static bool if_is_up = 0; /* IPv4 if marked as up */
static bool restore_term = 0; /* Restore TTY after closing link */
static int n_pollfds = 0; /* total count of polled fd */
static int link_mtu; /* link Maximum Transmit Unit */
static int tty_nmodules; /* total count of TTY modules used */
/* array of TTY modules used */
static int tty_npushed; /* total count of pushed PPP modules */
static bool use_plink = 0; /* Use I_LINK by default */
static bool plumbed = 0; /* Use existing interface */
static const char *drvnam = PPP_DEV_NAME;
static bool integrated_driver = 0;
static option_t solaris_option_list[] = {
OPT_PRIV|1 },
OPT_PRIV|0 },
OPT_PRIV|1 },
{ NULL }
};
/*
* Prototypes for procedures local to this file.
*/
static int translate_speed __P((int));
static int baud_rate_of __P((int));
static int dlpi_attach __P((int, int));
static int dlpi_info_req __P((int));
static int plumb_ipif __P((int));
static int unplumb_ipif __P((int));
#ifdef INET6
static int plumb_ip6if __P((int));
static int unplumb_ip6if __P((int));
static int open_ip6fd(void);
#endif /* INET6 */
static int open_ipfd(void);
/*
* Wrapper for regular ioctl; masks out EINTR.
*/
static int
{
int retv;
errno = 0;
break;
}
return (retv);
}
/*
* sys_check_options()
*
* Check the options that the user specified.
*/
int
sys_check_options(void)
{
if (plumbed) {
if (req_unit == -1)
req_unit = -2;
ipmuxid = 0;
ip6muxid = 0;
}
return (1);
}
/*
* sys_options()
*
* Add or remove system-specific options.
*/
void
sys_options(void)
{
(void) remove_option("ktune");
(void) remove_option("noktune");
}
/*
* sys_ifname()
*
* Set ifname[] to contain name of IP interface for this unit.
*/
void
sys_ifname(void)
{
const char *cp;
else
cp++;
}
/*
* ppp_available()
*
* Check whether the system has any ppp interfaces.
*/
int
ppp_available(void)
{
int fd;
return (1);
/*
* Simple check for system using Apollo POS without SUNWpppd
* here, since the user may not have the same privileges (as
* determined later). If Apollo were just shipped with the
* full complement of packages, this wouldn't be an issue.
*/
if (devnam[0] == '\0' &&
typ == PPPTYP_MUX) {
return (1);
}
}
return (0);
}
static int
open_ipfd(void)
{
if (ipfd < 0) {
}
return (ipfd);
}
static int
read_ip_interface(int unit)
{
struct sockaddr_in sin;
return (0);
/* Get the existing MTU */
return (0);
}
if (ifr.ifr_metric != 0 &&
/* Get the local IP address */
warn("Couldn't get local IP address (%s): %m",
return (0);
}
dbglog("got local address %I from interface",
}
/* Get the remote IP address */
warn("Couldn't get remote IP address (%s): %m",
return (0);
}
dbglog("got remote address %I from interface",
}
return (1);
}
#ifdef INET6
static int
open_ip6fd(void)
{
if (ip6fd < 0) {
}
return (ip6fd);
}
static int
read_ipv6_interface(int unit)
{
return (0);
/* Get the existing MTU */
return (0);
}
/* Get the local IPv6 address */
warn("Couldn't get local IPv6 address (%s): %m",
return (0);
}
}
/* Get the remote IP address */
warn("Couldn't get remote IPv6 address (%s): %m",
return (0);
}
}
return (1);
}
#endif /* INET6 */
/*
* Read information on existing interface(s) and configure ourselves
* to negotiate appropriately.
*/
static void
read_interface(int unit)
{
dbglog("reading existing interface data; %sip %sipv6",
#ifdef INET6
IPV6CP_ENABLED ? "" :
#endif
"!");
IPCP_ENABLED = 0;
#ifdef INET6
IPV6CP_ENABLED = 0;
#endif
}
/*
* sys_init()
*
* System-dependent initialization.
*/
void
sys_init(bool open_as_user)
{
uint32_t x;
if (pppfd != -1) {
return;
}
/*
* Check for integrated driver-like devices (such as
* POS). These identify themselves as "PPP
* multiplexor" drivers.
*/
if (open_as_user)
if (open_as_user)
(void) seteuid(0);
if (pppfd >= 0 &&
typ == PPPTYP_MUX) {
integrated_driver = 1;
} else if (demand) {
pppfd = -1;
} else {
pppfd = -1;
}
}
/*
* Open Solaris PPP device driver.
*/
if (pppfd < 0)
if (pppfd < 0) {
}
if (kdebugflag & 1) {
x = PPPDBG_LOG + PPPDBG_DRIVER;
warn("PPPIO_DEBUG ioctl for mux failed: %m");
}
}
/*
* Assign a new PPA and get its unit number.
*/
x = req_unit;
fatal("No idle interfaces available for use");
fatal("PPPIO_NEWPPA ioctl failed: %m");
}
ifunit = x;
if (plumbed)
else
}
/*
* Enable packet time-stamping when idle option is specified. Note
* that we need to only do this on the control stream. Subsequent
* streams attached to this control stream (ppa) will inherit
* the time-stamp bit.
*/
if (idle_time_limit > 0) {
warn("PPPIO_USETIMESTAMP ioctl failed: %m");
}
}
if (plumbed) {
sys_ifname();
read_interface(0);
}
}
int
sys_extra_fd(void)
{
int fd;
fd = extra_dev_fd;
extra_dev_fd = -1;
return (fd);
}
static int
open_udpfd(void)
{
int udpfd;
if (udpfd < 0) {
}
return (udpfd);
}
/*
* plumb_ipif()
*
* Perform IP interface plumbing.
*/
/*ARGSUSED*/
static int
plumb_ipif(int unit)
{
uint32_t x;
return (0);
}
if (plumbed)
return (1);
return (0);
return (0);
if (tmpfd < 0) {
if (udpfd != -1)
return (0);
}
if (kdebugflag & 1) {
x = PPPDBG_LOG + PPPDBG_DRIVER;
warn("PPPIO_DEBUG ioctl for mux failed: %m");
}
}
goto err_ret;
}
/*
* Assign ppa according to the unit number returned by ppp device
* after plumbing is completed above. Without setting the ppa, ip
* module will return EINVAL upon setting the interface UP
* (SIOCSxIFFLAGS). This is because ip module in 2.8 expects two
* DLPI_INFO_REQ to be sent down to the driver (below ip) before
* IFF_UP bit can be set. Plumbing the device causes one DLPI_INFO_REQ
* to be sent down, and the second DLPI_INFO_REQ is sent upon receiving
* IF_UNITSEL (old) or SIOCSLIFNAME (new) ioctls. Such setting of the
* ppa is required because the ppp DLPI provider advertises itself as
* a DLPI style 2 type, which requires a point of attachment to be
* specified. The only way the user can specify a point of attachment
* is via SIOCSLIFNAME or IF_UNITSEL. Such changes in the behavior of
* ip module was made to meet new or evolving standards requirements.
*/
goto err_ret;
}
if (use_plink) {
if (ipmuxid < 0) {
error("Can't I_PLINK PPP device to IP: %m");
goto err_ret;
}
} else {
if (ipmuxid < 0) {
error("Can't I_LINK PPP device to IP: %m");
goto err_ret;
}
}
goto err_ret;
}
if (udpfd != -1)
return (1);
if (udpfd != -1)
return (0);
}
/*
* unplumb_ipif()
*
* Perform IP interface unplumbing. Possibly called from die(), so there
* shouldn't be any call to die() or fatal() here.
*/
static int
unplumb_ipif(int unit)
{
int id;
return (0);
}
return (1);
return (0);
/*
* Note: must re-get mux ID, since any intervening
* ifconfigs will change this.
*/
warn("Can't get mux fd: SIOCGLIFMUXID: %m");
} else {
if (fd < 0) {
warn("Can't get mux fd: _I_MUXID2FD: %m");
}
}
}
/*
* Mark down and unlink the ip interface.
*/
if (default_route_gateway != 0) {
(void) cifdefaultroute(0, default_route_gateway,
}
if (proxy_arp_addr != 0) {
(void) cifproxyarp(0, proxy_arp_addr);
}
ipmuxid = -1;
if (plumbed)
return (1);
if (use_plink) {
error("Can't I_PUNLINK PPP from IP: %m");
if (fd != -1)
return (0);
}
if (fd != -1)
} else {
error("Can't I_UNLINK PPP from IP: %m");
return (0);
}
}
return (1);
}
/*
* sys_cleanup()
*
* Restore any system state we modified before exiting: mark the
* should not call die() because it's called from die().
*/
void
{
(void) unplumb_ipif(0);
#ifdef INET6
(void) unplumb_ip6if(0);
#endif /* INET6 */
}
/*
* get_first_hwaddr()
*
* Stores the first hardware interface address found in the system
* into addr and return 1 upon success, or 0 if none is found. This
* is also called from the multilink code.
*/
int
int msize;
{
char *req;
return (0);
}
if (fd < 0) {
error("get_first_hwaddr: error opening IP socket: %m");
return (0);
}
/*
* Find out how many interfaces are running
*/
}
novm("interface request structure.");
}
/*
* Get interface configuration info for all interfaces
*/
error("SIOCGIFCONF: %m");
return (0);
}
/*
* And traverse each interface to look specifically for the first
* occurence of an Ethernet interface which has been marked up
*/
found = 0;
continue;
}
continue;
}
!= (IFF_UP | IFF_BROADCAST)) {
continue;
}
continue;
}
found = 1;
break;
}
return (found);
}
/*
* get_if_hwaddr()
*
* Get the hardware address for the specified network interface device.
* Return the length of the MAC address (in bytes) or -1 if error.
*/
int
int msize;
char *if_name;
{
bool dlpi_err = 0;
char *adrp, *q;
struct {
union DL_primitives prim;
char space[64];
} reply;
return (-1);
}
/*
* We have to open the device and ask it for its hardware address.
* First split apart the device name and unit.
*/
if (!isdigit(*q)) {
break;
}
}
q[1] = '\0';
/*
* Open the device and do a DLPI attach and phys_addr_req.
*/
if (iffd < 0) {
return (-1);
}
dlpi_err = 1;
sizeof (reply)) < 0) {
dlpi_err = 1;
} else if (dlpi_info_req(iffd) < 0) {
dlpi_err = 1;
sizeof (reply)) < 0) {
dlpi_err = 1;
}
iffd = -1;
if (dlpi_err) {
return (-1);
}
} else {
}
/*
* Check if we have enough space to copy the address to.
*/
return (-1);
}
return (adrlen);
}
/*
* giflags()
*/
static int
{
int fd;
*retval = 0;
if (fd < 0) {
error("giflags: error opening IP socket: %m");
return (errno);
}
return (errno);
}
return (errno);
}
/*
* sys_close()
*
* Clean up in a child process before exec-ing.
*/
void
{
if (ipfd != -1) {
ipfd = -1;
}
#ifdef INET6
if (ip6fd != -1) {
ip6fd = -1;
}
#endif /* INET6 */
if (pppfd != -1) {
pppfd = -1;
}
}
/*
* any_compressions()
*
* Check if compression is enabled or not. In the STREAMS implementation of
* kernel-portion pppd, the comp STREAMS module performs the ACFC, PFC, as
* well CCP and VJ compressions. However, if the user has explicitly declare
* to not enable them from the command line, there is no point of having the
* comp module be pushed on the stream.
*/
static int
any_compressions(void)
{
if ((!lcp_wantoptions[0].neg_accompression) &&
(!lcp_wantoptions[0].neg_pcompression) &&
(!ccp_protent.enabled_flag) &&
(!ipcp_wantoptions[0].neg_vj)) {
return (0);
}
return (1);
}
/*
* modpush()
*
* Push a module on the stream.
*/
static int
{
return (-1);
}
}
}
return (0);
}
/*
* establish_ppp()
*
* Turn the serial port into a ppp interface.
*/
int
int fd;
{
int i;
uint32_t x;
if (default_device && !notty) {
}
if (integrated_driver)
return (pppfd);
/*
* Pop any existing modules off the tty stream
*/
for (i = 0; ; ++i) {
break;
}
}
tty_nmodules = i;
/*
* Push the async hdlc module and the compressor module
*/
tty_npushed = 0;
if (!sync_serial && !already_ppp &&
return (-1);
}
/*
* There's no need to push comp module if we don't intend
* to compress anything
*/
if (any_compressions()) {
}
/*
* Link the serial port under the PPP multiplexor
*/
error("Can't link tty to PPP mux: %m");
return (-1);
}
if (tty_npushed == 0 && !already_ppp) {
warn("unable to set LASTMOD on PPP mux: %m");
}
}
/*
* Debug configuration must occur *after* I_LINK.
*/
if (kdebugflag & 4) {
x = PPPDBG_LOG + PPPDBG_AHDLC;
warn("PPPIO_DEBUG ioctl for ahdlc module failed: %m");
}
}
x = PPPDBG_LOG + PPPDBG_COMP;
warn("PPPIO_DEBUG ioctl for comp module failed: %m");
}
}
return (pppfd);
}
/*
* restore_loop()
*
* Reattach the ppp unit to the loopback. This doesn't need to do anything
* because disestablish_ppp does it
*/
void
{
}
/*
* disestablish_ppp()
*
* Restore the serial port to normal operation. It attempts to reconstruct
* the stream with the previously popped modules. This shouldn't call die()
* because it's called from die(). Stream reconstruction is needed in case
*/
void
int fd;
{
int i;
return;
}
if (!hungup) {
error("Can't unlink tty from PPP mux: %m");
}
}
fdmuxid = -1;
if (!hungup) {
--tty_npushed;
}
for (i = tty_nmodules - 1; i >= 0; --i) {
error("Couldn't restore tty module %s: %m",
tty_modules[i]);
}
}
}
/*
* If we have received a hangup, we need to send a
* SIGHUP to the terminal's controlling process.
* The reason is that the original stream head for
* the terminal hasn't seen the M_HANGUP message
* (it went up through the ppp driver to the stream
*/
}
}
/*
* clean_check()
*
* Check whether the link seems not to be 8-bit clean
*/
void
{
uint32_t x;
char *s = NULL;
/*
* Skip this is synchronous link is used, since spppasyn won't
* be anywhere in the stream below to handle the ioctl.
*/
if (sync_serial) {
return;
}
warn("unable to obtain serial link status: %m");
return;
}
switch (~x) {
case RCV_B7_0:
s = "bit 7 set to 1";
break;
case RCV_B7_1:
s = "bit 7 set to 0";
break;
case RCV_EVNP:
s = "odd parity";
break;
case RCV_ODDP:
s = "even parity";
break;
}
if (s != NULL) {
warn("Serial link is not 8-bit clean:");
warn("All received characters had %s", s);
}
}
/*
* List of valid speeds.
*/
struct speed {
int speed_int;
int speed_val;
} speeds [] = {
#ifdef B50
{ 50, B50 },
#endif
#ifdef B75
{ 75, B75 },
#endif
#ifdef B110
{ 110, B110 },
#endif
#ifdef B134
{ 134, B134 },
#endif
#ifdef B150
{ 150, B150 },
#endif
#ifdef B200
{ 200, B200 },
#endif
#ifdef B300
{ 300, B300 },
#endif
#ifdef B600
{ 600, B600 },
#endif
#ifdef B1200
{ 1200, B1200 },
#endif
#ifdef B1800
{ 1800, B1800 },
#endif
#ifdef B2000
{ 2000, B2000 },
#endif
#ifdef B2400
{ 2400, B2400 },
#endif
#ifdef B3600
{ 3600, B3600 },
#endif
#ifdef B4800
{ 4800, B4800 },
#endif
#ifdef B7200
{ 7200, B7200 },
#endif
#ifdef B9600
{ 9600, B9600 },
#endif
#ifdef B19200
{ 19200, B19200 },
#endif
#ifdef B38400
{ 38400, B38400 },
#endif
#ifdef EXTA
{ 19200, EXTA },
#endif
#ifdef EXTB
{ 38400, EXTB },
#endif
#ifdef B57600
{ 57600, B57600 },
#endif
#ifdef B76800
{ 76800, B76800 },
#endif
#ifdef B115200
{ 115200, B115200 },
#endif
#ifdef B153600
{ 153600, B153600 },
#endif
#ifdef B230400
{ 230400, B230400 },
#endif
#ifdef B307200
{ 307200, B307200 },
#endif
#ifdef B460800
{ 460800, B460800 },
#endif
{ 0, 0 }
};
/*
* translate_speed()
*
*/
static int
translate_speed(int bps)
{
if (bps == 0) {
return (0);
}
}
}
return (0);
}
/*
* baud_rate_of()
*
*/
static int
baud_rate_of(int speed)
{
if (speed == 0) {
return (0);
}
}
}
return (0);
}
/*
* set_up_tty()
*
* Set up the serial port on `fd' for 8 bits, no parity, at the requested
* speed, etc. If `local' is true, set CLOCAL regardless of whether the
* modem option was specified.
*/
void
{
int speed;
if (already_ppp)
return;
if (sync_serial) {
restore_term = 0;
baud_rate = 0;
sizeof (sm)) < 0) {
return;
}
} else {
fatal("tcgetattr: %m");
}
if (!restore_term) {
inittermios = tios;
/*
* ptem returns EINVAL if all zeroes.
* Strange and unfixable code.
*/
} else {
warn("unable to get TTY window "
"size: %m");
}
}
}
if (crtscts > 0) {
} else if (crtscts < 0) {
}
}
if (crtscts == -2) {
}
if (speed) {
} else {
/*
* We can't proceed if the serial port speed is 0,
* since that implies that the serial port is disabled.
*/
fatal("Baud rate for %s is 0; need explicit "
"baud rate", devnam);
}
}
fatal("tcsetattr: %m");
}
dbglog("%s speed set to %d bps",
restore_term = 1;
}
}
/*
* restore_tty()
*
* Restore the terminal to the saved settings.
*/
void
int fd;
{
if (restore_term == 0) {
return;
}
if (!default_device) {
/*
* Turn off echoing, because otherwise we can get into
* a loop with the tty and the modem echoing to each
* other. We presume we are the sole user of this tty
* device, so when we close it, it will revert to its
* defaults anyway.
*/
}
warn("tcsetattr: %m");
}
}
warn("unable to set TTY window size: %m");
}
}
restore_term = 0;
}
/*
* setdtr()
*
* Control the DTR line on the serial port. This is called from die(), so it
* shouldn't call die()
*/
void
{
if (!already_ppp &&
}
}
/*
* open_loopback()
*
* Open the device we use for getting packets in demand mode. Under Solaris 2,
* we use our existing fd to the ppp driver.
*/
int
{
/*
* Plumb the interface.
*/
if (IPCP_ENABLED && (plumb_ipif(0) == 0)) {
fatal("Unable to initialize IP interface for demand dial.");
}
#ifdef INET6
if (IPV6CP_ENABLED && (plumb_ip6if(0) == 0)) {
fatal("Unable to initialize IPv6 interface for demand dial.");
}
#endif /* INET6 */
return (pppfd);
}
/*
* output()
*
* Output PPP packet downstream
*/
/*ARGSUSED*/
void
int unit;
uchar_t *p;
int len;
{
int retries, n;
bool sent_ok = 1;
retries = 4;
continue;
if (--retries < 0 ||
error("Couldn't send packet: %m");
sent_ok = 0;
}
break;
}
do {
/* wait for up to 0.25 seconds */
}
}
}
/*
* wait_input()
*
* Wait until there is data available, for the length of time specified by
* timo (indefinite if timo is NULL).
*/
void
{
int t;
fatal("poll: %m");
}
}
/*
* add_fd()
*
* Add an fd to the set that wait_input waits for.
*/
void
int fd;
{
int n;
if (fd < 0) {
return;
}
for (n = 0; n < n_pollfds; ++n) {
return;
}
}
if (n_pollfds < MAX_POLLFDS) {
++n_pollfds;
} else {
fatal("add_fd: too many inputs!");
}
}
/*
* remove_fd()
*
* Remove an fd from the set that wait_input waits for.
*/
void
int fd;
{
int n;
for (n = 0; n < n_pollfds; ++n) {
while (++n < n_pollfds) {
}
--n_pollfds;
break;
}
}
}
static void
{
const char *cp;
char sbuf[32];
if (len < 4) {
return;
}
bp += 2;
if (!(proto & 1))
return;
}
} else {
proto);
}
} else {
else
}
return;
}
}
}
/*
* handle_bind()
*/
static void
{
/*
* Here we might, in the future, handle DL_BIND_REQ notifications
* in order to close and re-open a NCP when certain interface
* parameters (addresses, etc.) are changed via external mechanisms
* such as through the "ifconfig" program.
*/
switch (reason) {
case PPP_LINKSTAT_IPV4_BOUND:
break;
#ifdef INET6
case PPP_LINKSTAT_IPV6_BOUND:
break;
#endif
default:
error("handle_bind: unrecognized reason");
break;
}
}
/*
* handle_unbind()
*/
static void
{
bool iff_up_isset;
int rc;
static const char *unplumb_str = "unplumbed";
static const char *down_str = "downed";
/*
* Since the kernel driver (sppp) notifies this daemon of the
* a NCP), we need to explicitly test the "actual" status of
* the interface instance for which the notification is destined
* bind-unbind-detach during the early life of the interface,
* and when certain interface parameters change. A DL_UNBIND_REQ
* our receiving of the PPP_LINKSTAT_*_UNBOUND link status message)
* is not enough to conclude that the interface has been marked
* DOWN (its IFF_UP bit is cleared) or is going away. Therefore,
* notification, to determine whether the interface is DOWN
* for real, and only take the necessary actions when IFF_UP
* bit for the interface instance is actually cleared.
*/
switch (reason) {
(void) sleep(1);
if (!iff_up_isset) {
if_is_up = 0;
ipmuxid = -1;
info("IPv4 interface %s by administrator",
"administratively disconnected");
}
break;
#ifdef INET6
(void) sleep(1);
if (!iff_up_isset) {
if6_is_up = 0;
ip6muxid = -1;
info("IPv6 interface %s by administrator",
fsm_close(&ipv6cp_fsm[0],
"administratively disconnected");
}
break;
#endif
default:
error("handle_unbind: unrecognized reason");
break;
}
}
/*
* read_packet()
*
* Get a PPP packet from the serial device.
*/
int
{
int flags;
int len;
int rc;
bool flushmode;
flushmode = 0;
for (;;) {
flags = 0;
if (sys_read_packet_hook != NULL) {
flags);
}
if (len < 0) {
return (-1);
}
fatal("Error reading packet: %m");
}
/*
* If there's more data on stream head, keep reading
* but discard, since the stream is now corrupt.
*/
dbglog("More data; input packet garbled");
flushmode = 1;
continue;
}
if (flushmode)
return (-1);
/*
* If there's more ctl on stream head, keep reading,
* but start discarding. We can't deal with fragmented
* messages at all.
*/
dbglog("More control; stream garbled");
flushmode = 1;
continue;
}
if (flushmode)
return (-1);
warn("read_packet: ctl.len %d < "
"sizeof ppp_ls %d",
return (-1);
}
/* Skip, as we don't understand it */
dbglog("read_packet: unrecognized control %lX",
return (-1);
}
switch (plp->ppp_message) {
case PPP_LINKSTAT_HANGUP:
return (0); /* Hangup */
/* For use by integrated drivers. */
case PPP_LINKSTAT_UP:
lcp_lowerdown(0);
lcp_lowerup(0);
return (0);
case PPP_LINKSTAT_NEEDUP:
return (-1); /* Demand dial */
return (-1);
case PPP_LINKSTAT_IPV4_BOUND:
return (-1);
#ifdef INET6
return (-1);
case PPP_LINKSTAT_IPV6_BOUND:
return (-1);
#endif
default:
warn("read_packet: unknown link status type!");
return (-1);
}
} else {
/*
* We get here on zero length data or control.
*/
return (-1);
}
}
}
/*
* get_loop_output()
*
* Get outgoing packets from the ppp device, and detect when we want to bring
* the real link up. Return value is 1 if we need to bring up the link, or 0
* otherwise.
*/
int
{
int loops;
/*
* In the Solaris 2.x kernel-level portion implementation, packets
* which are received on a demand-dial interface are immediately
* discarded, and a notification message is sent up the control
* stream to the pppd process. Therefore, the call to read_packet()
* below is merely there to wait for such message.
*/
lastlink_status = 0;
loops = 0;
while (read_packet(inpacket_buf) > 0) {
if (++loops > 10)
break;
}
return (lastlink_status == PPP_LINKSTAT_NEEDUP);
}
#ifdef MUX_FRAME
/*ARGSUSED*/
void
int unit;
{
/*
* Since muxed frame feature is implemented in the async module,
* don't send down the ioctl in the synchronous case.
*/
error("Couldn't set mux option: %m");
}
}
}
/*ARGSUSED*/
void
int unit;
{
/*
* Since muxed frame feature is implemented in the async module,
* don't send down the ioctl in the synchronous case.
*/
error("Couldn't set receive mux option: %m");
}
}
}
#endif
/*
* ppp_send_config()
*
* Configure the transmit characteristics of the ppp interface.
*/
/*ARGSUSED*/
void
int unit;
int mtu;
int pcomp;
int accomp;
{
if (pppfd == -1) {
error("ppp_send_config called with invalid device handle");
return;
}
return;
}
error("Couldn't set MTU: %m");
}
if (fdmuxid != -1) {
if (!sync_serial) {
sizeof (asyncmap), 0) < 0) {
error("Couldn't set transmit ACCM: %m");
}
}
}
}
}
/*
* ppp_set_xaccm()
*
* Set the extended transmit ACCM for the interface.
*/
/*ARGSUSED*/
void
int unit;
{
if (sync_serial) {
return;
}
sizeof (ext_accm), 0) < 0) {
warn("Couldn't set extended ACCM: %m");
}
}
}
/*
* ppp_recv_config()
*
* Configure the receive-side characteristics of the ppp interface.
*/
/*ARGSUSED*/
void
int unit;
int mru;
int pcomp;
int accomp;
{
if (pppfd == -1) {
error("ppp_recv_config called with invalid device handle");
return;
}
return;
}
error("Couldn't set MRU: %m");
}
if (fdmuxid != -1) {
if (!sync_serial) {
sizeof (asyncmap), 0) < 0) {
error("Couldn't set receive ACCM: %m");
}
}
}
}
}
#ifdef NEGOTIATE_FCS
/*
* ppp_send_fcs()
*
* Configure the sender-side FCS.
*/
/*ARGSUSED*/
void
{
if (sync_serial) {
return;
}
} else if (fcstype & FCSALT_NULL) {
fcs = PPPFCS_NONE;
} else {
}
warn("Couldn't set transmit FCS: %m");
}
}
/*
* ppp_recv_fcs()
*
* Configure the receiver-side FCS.
*/
/*ARGSUSED*/
void
{
if (sync_serial) {
return;
}
} else if (fcstype & FCSALT_NULL) {
fcs = PPPFCS_NONE;
} else {
}
warn("Couldn't set receive FCS: %m");
}
}
#endif
/*
* ccp_test()
*
* Ask kernel whether a given compression method is acceptable for use.
*/
/*ARGSUSED*/
int
int unit;
int opt_len;
int for_transmit;
{
return (1);
}
warn("Error in %s ioctl: %m",
}
#ifdef COMP_TUNE
/*
* ccp_tune()
*
* Tune compression effort level.
*/
/*ARGSUSED*/
void
{
uint32_t x;
x = effort;
warn("unable to set compression effort level: %m");
}
}
#endif
/*
* ccp_flags_set()
*
* Inform kernel about the current state of CCP.
*/
/*ARGSUSED*/
void
{
< 0) {
error("Couldn't set kernel CCP state: %m");
}
}
}
/*
* get_idle_time()
*
* Return how long the link has been idle.
*/
/*ARGSUSED*/
int
get_idle_time(u, pids)
int u;
{
int rc;
if (rc < 0) {
warn("unable to obtain idle time: %m");
}
return ((rc == 0) ? 1 : 0);
}
/*
* get_ppp_stats()
*
* Return statistics for the link.
*/
/*ARGSUSED*/
int
get_ppp_stats(u, stats)
int u;
struct pppd_stats *stats;
{
struct ppp_stats64 s64;
struct ppp_stats s;
/* Try first to get these from the 64-bit interface */
return (1);
}
error("Couldn't get link statistics: %m");
return (0);
}
return (1);
}
#if defined(FILTER_PACKETS)
/*
* set_filters()
*
* Transfer the pass and active filters to the kernel.
*/
int
struct bpf_program *pass;
struct bpf_program *active;
{
int ret = 1;
sizeof (struct bpf_program), 0) < 0) {
error("Couldn't set pass-filter in kernel: %m");
ret = 0;
}
}
sizeof (struct bpf_program), 0) < 0) {
error("Couldn't set active-filter in kernel: %m");
ret = 0;
}
}
return (ret);
}
#endif /* FILTER_PACKETS */
/*
* ccp_fatal_error()
*
* Returns 1 if decompression was disabled as a result of an error detected
* after decompression of a packet, 0 otherwise. This is necessary because
* of patent nonsense.
*/
/*ARGSUSED*/
int
int unit;
{
< 0) {
error("Couldn't get compression flags: %m");
}
return (0);
}
return (cf[0] & CCP_FATALERROR);
}
/*
* sifvjcomp()
*
* Config TCP header compression.
*/
/*ARGSUSED*/
int
{
/*
* Since VJ compression code is in the comp module, there's no
* point of sending down any ioctls pertaining to VJ compression
* when the module isn't pushed on the stream.
*/
if (!any_compressions()) {
return (1);
}
if (vjcomp) {
sizeof (maxcid), 0) < 0) {
error("Couldn't initialize VJ compression: %m");
return (0);
}
}
< 0) {
if (vjcomp) {
error("Couldn't enable VJ compression: %m");
} else {
error("Couldn't disable VJ compression: %m");
}
return (0);
}
return (1);
}
/*
* siflags()
*
* Set or clear the IP interface flags.
*/
int
u_int32_t f;
int set;
{
return (0);
}
return (0);
error("Couldn't get IP interface flags: %m");
return (0);
}
if (set) {
} else {
}
error("Couldn't set IP interface flags: %m");
return (0);
}
return (1);
}
/*
* sifup()
*
* Config the interface up and enable IP packets to pass.
*/
/*ARGSUSED*/
int
sifup(u)
int u;
{
if (if_is_up) {
return (1);
} else if (!IPCP_ENABLED) {
warn("sifup called when IPCP is disabled");
return (0);
} else if (ipmuxid == -1) {
warn("sifup called in wrong state");
return (0);
error("Unable to mark the IP interface UP");
return (0);
}
if_is_up = 1;
return (1);
}
/*
* sifdown()
*
* Config the interface down and disable IP. Possibly called from die(),
* so there shouldn't be any call to die() here.
*/
/*ARGSUSED*/
int
sifdown(u)
int u;
{
if (!IPCP_ENABLED) {
warn("sifdown called when IPCP is disabled");
return (0);
return (1);
error("Unable to mark the IP interface DOWN");
return (0);
}
if_is_up = 0;
return (1);
}
/*
* sifnpmode()
*
* Set the mode for handling packets for a given NP. Not worried
* about performance here since this is done only rarely.
*/
/*ARGSUSED*/
int
int u;
int proto;
{
const char *cp;
static const struct npi_entry {
const char *ne_name;
} npi_list[] = {
{ NPMODE_PASS, "pass" },
{ NPMODE_DROP, "drop" },
{ NPMODE_ERROR, "error" },
{ NPMODE_QUEUE, "queue" },
};
int i;
else
break;
else
return (1);
}
return (0);
}
return (1);
}
/*
* sifmtu()
*
* Config the interface IP MTU.
*/
int
int mtu;
{
return (0);
}
return (0);
mtu);
return (0);
}
return (1);
}
/*
* sifaddr()
*
* Config the interface IP addresses and netmask.
*/
/*ARGSUSED*/
int
sifaddr(u, o, h, m)
int u;
u_int32_t o;
u_int32_t h;
u_int32_t m;
{
struct sockaddr_in sin;
return (0);
}
return (0);
/*
* Set the IP interface MTU.
*/
return (0);
}
/*
* Set the IP interface local point-to-point address.
*/
return (0);
}
/*
* Set the IP interface remote point-to-point address.
*/
return (0);
}
remote_addr = h;
return (1);
}
/*
* cifaddr()
*
* Clear the interface IP addresses.
*/
/*ARGSUSED*/
int
cifaddr(u, o, h)
int u;
u_int32_t o;
u_int32_t h;
{
if (!IPCP_ENABLED) {
return (0);
}
/*
* Most of the work is done in sifdown().
*/
remote_addr = 0;
return (1);
}
/*
* sifroute()
*
* Add or delete a route.
*/
/*ARGSUSED*/
static int
{
return (0);
}
return (0);
return (0);
}
return (1);
}
/*
* sifdefaultroute()
*
* Assign a default route through the address given.
*/
/*ARGSUSED*/
int
sifdefaultroute(u, l, g)
int u;
u_int32_t l;
u_int32_t g;
{
return (0);
}
return (1);
}
/*
* cifdefaultroute()
*
* Delete a default route through the address given.
*/
/*ARGSUSED*/
int
cifdefaultroute(u, l, g)
int u;
u_int32_t l;
u_int32_t g;
{
if (!sifroute(u, 0, g, 0, "delete default")) {
return (0);
}
return (1);
}
/*
* sifproxyarp()
*
* Make a proxy ARP entry for the peer.
*/
/*ARGSUSED*/
int
int unit;
int quietflag;
{
struct sockaddr_in sin;
return (0);
}
return (0);
return (0);
}
if (!quietflag)
error("Couldn't set proxy ARP entry: %m");
return (0);
}
str);
}
return (1);
}
/*
* cifproxyarp()
*
* Delete the proxy ARP entry for the peer.
*/
/*ARGSUSED*/
int
int unit;
{
struct sockaddr_in sin;
return (0);
}
return (0);
error("Couldn't delete proxy ARP entry: %m");
return (0);
}
proxy_arp_addr = 0;
return (1);
}
/*
* get_ether_addr()
*
* Get the hardware address of an interface on the the same subnet as
* ipaddr. This routine uses old-style interfaces for intentional
* backward compatibility -- SIOCGLIF* isn't in older Solaris
* releases.
*/
static int
{
struct sockaddr_in sin;
return (0);
/*
* Scan through the system's network interfaces.
*/
}
if (nif <= 0)
return (0);
return (0);
}
error("Couldn't get system interface list: %m");
return (0);
}
/* LINTED */
continue;
}
/*
* Check that the interface is up, and not
* point-to-point or loopback.
*/
continue;
}
continue;
}
/*
* Get its netmask and check that it's on the right subnet.
*/
continue;
}
break;
}
}
if (!quietflag)
warn("No suitable interface found for proxy ARP of %I",
ipaddr);
return (0);
}
/*
* New way - get the address by doing an arp request.
*/
if (s < 0) {
error("get_ether_addr: error opening IP socket: %m");
return (0);
}
retv = 0;
} else {
sizeof (struct sockaddr_dl));
retv = 1;
}
(void) close(s);
return (retv);
}
/*
* dlpi_attach()
*
* Send down DL_ATTACH_REQ to driver.
*/
static int
{
if (fd < 0) {
return (-1);
}
}
/*
* dlpi_info_req()
*
* Send down DL_INFO_REQ to driver.
*/
static int
dlpi_info_req(int fd)
{
if (fd < 0) {
return (-1);
}
}
/*
* dlpi_get_reply()
*
* Poll to get DLPI reply message from driver.
*/
static int
int maxlen)
{
int flags;
int n;
if (fd < 0) {
return (-1);
}
/*
* Use poll to wait for a message with a timeout.
*/
do {
if (n <= 0) {
return (-1);
}
/*
* Get the reply.
*/
flags = 0;
return (-1);
}
if (debug) {
}
return (-1);
}
return (0);
}
if (debug) {
dbglog("dlpi error %d (unix errno %d) for prim %x\n",
} else {
dbglog("dlpi unexpected response prim %x\n",
}
}
return (-1);
}
/*
* GetMask()
*
* Return mask (bogus, but needed for compatibility with other platforms).
*/
/*ARGSUSED*/
{
return (0xffffffffUL);
}
/*
* logwtmp()
*
*/
/*ARGSUSED*/
void
const char *line;
const char *name;
const char *host;
{
if (name[0] != '\0') {
/*
* logging in
*/
} else {
}
}
/*
* get_host_seed()
*
* Return the serial number of this machine.
*/
int
{
char buf[32];
error("sysinfo: %m");
return (0);
}
}
/*
* strioctl()
*
* Wrapper for STREAMS I_STR ioctl. Masks out EINTR from caller.
*/
static int
{
return (-1);
}
dbglog("strioctl: expected %d bytes, got %d for cmd %x\n",
}
return (0);
}
/*
* have_route_to()
*
* Determine if the system has a route to the specified IP address.
* Returns 0 if not, 1 if so, -1 if we can't tell. `addr' is in network
* byte order. For demand mode to work properly, we have to ignore routes
* through our own interface. XXX Would be nice to use routing socket.
*/
int
{
int r, flags, i;
struct {
struct T_optmgmt_req req;
} req;
union {
struct T_optmgmt_ack ack;
unsigned char space[64];
} ack;
int nroutes;
return (0);
#ifdef T_CURRENT
#else
/* Old-style */
#endif
warn("have_route_to: putmsg: %m");
return (-1);
}
for (;;) {
flags = 0;
if (r == -1) {
warn("have_route_to: getmsg: %m");
return (-1);
}
dbglog("have_route_to: bad message len=%d prim=%d",
return (-1);
}
/* LINTED */
break;
}
while (r == MOREDATA) {
}
continue;
}
/*
* Note that we have to skip routes to our own
* interface in order for demand dial to work.
*
* XXX awful hack here. We don't know our own
* ifIndex, so we can't check ipRouteIfIndex here.
* Instead, we check the next hop address.
*/
for (;;) {
rp->ipRouteMask) == 0) {
dbglog("have route to %I/%I via %I",
rp->ipRouteNextHop);
return (1);
}
}
if (r == 0) {
break;
}
}
}
return (0);
}
/*
* get_pty()
*
* Assumes slave_name points to MAXPATHLEN bytes of space.
*/
int
int *master_fdp;
int *slave_fdp;
char *slave_name;
int uid;
{
int mfd;
int sfd;
char *pty_name;
if (mfd < 0) {
error("Couldn't open pty master: %m");
return (0);
}
dbglog("Didn't get pty slave name on first try; sleeping.");
/* In case "grow" operation is in progress; try again. */
(void) sleep(1);
}
error("Couldn't get name of pty slave");
return (0);
}
warn("Couldn't change owner of pty slave: %m");
}
warn("Couldn't change permissions on pty slave: %m");
}
warn("Couldn't unlock pty slave: %m");
}
if (sfd < 0) {
return (0);
}
warn("Couldn't push ptem module on pty slave: %m");
}
*master_fdp = mfd;
return (1);
}
#ifdef INET6
static int
open_udp6fd(void)
{
int udp6fd;
if (udp6fd < 0) {
}
return (udp6fd);
}
/*
* plumb_ip6if()
*
* Perform IPv6 interface plumbing.
*/
/*ARGSUSED*/
static int
plumb_ip6if(int unit)
{
uint32_t x;
return (0);
}
if (plumbed)
return (1);
return (0);
return (0);
if (tmpfd < 0) {
if (udp6fd != -1)
return (0);
}
if (kdebugflag & 1) {
x = PPPDBG_LOG + PPPDBG_DRIVER;
warn("PPPIO_DEBUG ioctl for mux failed: %m");
}
}
goto err_ret;
}
/*
* Sets interface ppa and flags (refer to comments in plumb_ipif for
* the IF_UNITSEL ioctl). In addition, the IFF_IPV6 bit must be set in
* order to declare this as an IPv6 interface.
*/
error("Couldn't get IPv6 interface flags: %m");
goto err_ret;
}
goto err_ret;
}
if (use_plink) {
if (ip6muxid < 0) {
error("Can't I_PLINK PPP device to IPv6: %m");
goto err_ret;
}
} else {
if (ip6muxid < 0) {
error("Can't I_LINK PPP device to IPv6: %m");
goto err_ret;
}
}
error("Can't set mux ID: SIOCSLIFMUXID: %m");
goto err_ret;
}
if (udp6fd != -1)
return (1);
if (udp6fd != -1)
return (0);
}
/*
* unplumb_ip6if()
*
* Perform IPv6 interface unplumbing. Possibly called from die(), so there
* shouldn't be any call to die() here.
*/
static int
unplumb_ip6if(int unit)
{
int id;
return (0);
}
return (1);
}
return (0);
/*
* Note: must re-get mux ID, since any intervening
* ifconfigs will change this.
*/
warn("Can't get mux fd: SIOCGLIFMUXID: %m");
} else {
if (fd < 0) {
warn("Can't get mux fd: _I_MUXID2FD: %m");
}
}
}
/*
* Mark down and unlink the IPv6 interface.
*/
if (plumbed)
return (1);
ip6muxid = -1;
if (use_plink) {
error("Can't recapture mux fd: _I_MUXID2FD: %m");
return (0);
}
error("Can't I_PUNLINK PPP from IPv6: %m");
return (0);
}
} else {
error("Can't I_UNLINK PPP from IPv6: %m");
return (0);
}
}
return (1);
}
/*
* sif6flags()
*
* Set or clear the IPv6 interface flags.
*/
int
u_int32_t f;
int set;
{
int fd;
return (0);
}
if (fd < 0) {
error("sif6flags: error opening IPv6 socket: %m");
return (0);
}
error("Couldn't get IPv6 interface flags: %m");
return (0);
}
if (set) {
lifr.lifr_flags |= f;
} else {
lifr.lifr_flags &= ~f;
}
error("Couldn't set IPv6 interface flags: %m");
return (0);
}
return (1);
}
/*
* sif6up()
*
* Config the IPv6 interface up and enable IPv6 packets to pass.
*/
/*ARGSUSED*/
int
int unit;
{
if (if6_is_up) {
return (1);
} else if (!IPV6CP_ENABLED) {
warn("sif6up called when IPV6CP is disabled");
return (0);
} else if (ip6muxid == -1) {
warn("sif6up called in wrong state");
return (0);
error("Unable to mark the IPv6 interface UP");
return (0);
}
if6_is_up = 1;
return (1);
}
/*
* sif6down()
*
* Config the IPv6 interface down and disable IPv6. Possibly called from
* die(), so there shouldn't be any call to die() here.
*/
/*ARGSUSED*/
int
int unit;
{
if (!IPV6CP_ENABLED) {
warn("sif6down called when IPV6CP is disabled");
return (0);
return (1);
error("Unable to mark the IPv6 interface DOWN");
return (0);
}
if6_is_up = 0;
return (1);
}
/*
* sif6mtu()
*
* Config the IPv6 interface MTU.
*/
int
int mtu;
{
int s;
return (0);
}
if (s < 0) {
error("sif6mtu: error opening IPv6 socket: %m");
return (0);
}
(void) close(s);
return (0);
}
(void) close(s);
return (1);
}
/*
* sif6addr()
*
* Config the interface with an IPv6 link-local address.
*/
/*ARGSUSED*/
int
int unit;
{
struct sockaddr_storage laddr;
int fd;
return (0);
}
if (fd < 0) {
error("sif6addr: error opening IPv6 socket: %m");
return (0);
}
/*
* Set the IPv6 interface MTU.
*/
return (0);
}
/*
* to DL_PHYS_ADDR_REQ with zero values, hence the interface token
* came to be zero too, and without this, in.ndpd will complain.
*/
return (0);
}
/*
* Set the IPv6 interface local point-to-point address.
*/
error("Couldn't set local IPv6 address (%s): %m",
return (0);
}
/*
* Set the IPv6 interface local point-to-point address.
*/
error("Couldn't set remote IPv6 address (%s): %m",
return (0);
}
return (1);
}
/*
* cif6addr()
*/
/*ARGSUSED*/
int
cif6addr(u, o, h)
int u;
eui64_t o;
eui64_t h;
{
if (!IPV6CP_ENABLED) {
return (0);
}
/*
* Do nothing here, as everything has been done in sif6down().
*/
return (1);
}
/*
* ether_to_eui64()
*
* Convert 48-bit Ethernet address into 64-bit EUI. Walks the list of valid
* ethernet interfaces, and convert the first found 48-bit MAC address into
* EUI 64. caller also assumes that the system has a properly configured
* Ethernet interface for this function to return non-zero.
*/
int
{
struct ether_addr eth_addr;
return (0);
}
sizeof (eth_addr.ether_addr_octet))) {
return (0);
}
/*
* And convert the EUI-48 into EUI-64, per RFC 2472 [sec 4.1]
*/
return (1);
}
#endif /* INET6 */
struct bit_ent {
int val;
};
/* see sbuf[] below if you change this list */
#if 0
#endif
};
static void
{
int nmods, i;
int mstate;
char *str;
if (nmods < 0) {
error("unable to get module count: %m");
} else {
novm("module list");
error("unable to get module names: %m");
} else {
}
}
error("unable to get modem state: %m");
} else {
sbuf[0] = '\0';
if (sbuf[0] != '\0')
}
}
}
}
/*
* Print state of serial link. The stream might be linked under the
* and relink it when done. Otherwise, it's not possible to use
* ioctl() on the stream.
*/
void
{
bool was_linked;
if (pppfd == -1)
return;
if (ttyfd == -1) {
return;
}
error("I_UNLINK: %m");
} else {
fdmuxid = -1;
if (was_linked &&
fatal("I_LINK: %m");
}
}
/*
* send ioctl to driver asking it to block packets with network protocol
* proto in the control queue until the queue for proto is plumbed.
*/
void
{
if (proto > 0x7fff) {
return;
}
warn("PPPIO_BLOCKNP ioctl failed %m");
}
}
/*
* send ioctl to driver asking it to release packets with network protocol
* proto from control queue to the protocol specific queue.
*/
void
{
if (proto > 0x7fff) {
return;
}
warn("PPPIO_UNBLOCKNP ioctl failed %m");
}
}