1N/A * The contents of this file are subject to the terms of the 1N/A * Common Development and Distribution License (the "License"). 1N/A * You may not use this file except in compliance with the License. 1N/A * See the License for the specific language governing permissions 1N/A * and limitations under the License. 1N/A * When distributing Covered Code, include this CDDL HEADER in each 1N/A * If applicable, add the following below this CDDL HEADER, with the 1N/A * fields enclosed by brackets "[]" replaced with your own identifying 1N/A * information: Portions Copyright [yyyy] [name of copyright owner] 1N/A * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 1N/A * Use is subject to license terms. 1N/A * pppoe.c - pppd plugin to handle PPPoE operation. 1N/A/* Saved hook pointers */ 1N/A/* Room for 3 IPv4 addresses and metric */ 1N/A/* Environment string for routes */ 1N/A * wrapper for STREAMS I_STR ioctl. 1N/A * If the user named the tunneling device, check that it is 1N/A * reasonable; otherwise check that standard input is the tunnel. 1N/A int tstfd;
/* fd for device being checked */ 1N/A int err;
/* saved errno value */ 1N/A int intv;
/* integer return value (from ioctl) */ 1N/A * Open as real user so that modes on device can be 1N/A * used to limit access. 1N/A * When we're about to call one of the up or down scripts, change the 1N/A * second argument to contain the interface name and selected PPPoE 1N/A * Concatenate and save strings from command line into environment 1N/A * Convert Message Of The Moment (MOTM) and Host Uniform Resource 1N/A * Locator (HURL) strings into environment variables and command-line 1N/A * arguments for script. 1N/A /* Must have room for two strings and NULL terminator. */ 1N/A * Convert IP Route Add structures into environment variables and 1N/A * command-line arguments for script. 1N/A /* Must have room for four strings and NULL terminator. */ 1N/A /* No alignment restrictions on source; copy to local. */ 1N/A /* Save off the environment variable version of this. */ 1N/A * If we get here, then the driver has already validated the sender, 1N/A * the PPPoE version, the message length, and session ID. The code 1N/A * number is known not to be zero. 1N/A * Warning: the data->buf pointer here is not necessarily properly 1N/A * aligned for access to the poep_session_id or poep_length members. 1N/A /* LINTED: alignment */ 1N/A dbglog(
"received PPPoE PADT; connection has been closed");
1N/A /* LINTED: alignment */ 1N/A /* Active Discovery Message and Network extensions */ 1N/A /* Note: strdup doesn't handle NULL input. */ 1N/A /* Free storage allocated by handle_{motm_hurl,ip_route_add} */ 1N/A * Handle an action code passed up from the driver. 1N/A * sys-solaris has just read in a packet; grovel through it and see if 1N/A * it's something we need to handle ourselves. 1N/A /* LINTED: alignment */ 1N/A /* ptc_discrim is the first uint32_t of the structure. */ 1N/A /* Forward along to other plug-ins */ 1N/A * Get an environment variable from the chat script. 1N/A * Read environment variables exported by chat script. 1N/A fatal(
"unable to open environment file: %m");
1N/A for (i =
1; ; i++) {
1N/A "VENDOR_SPECIFIC_%d", i);