Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 72885 Details for
Bug 112049
baselayout-1.12.0_pre10 : pppd net module - updetach & linkname pppd params
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
New pre10-r1 patch
baselayout.patch (text/plain), 10.30 KB, created by
Roy Marples (RETIRED)
on 2005-11-14 10:20:29 UTC
(
hide
)
Description:
New pre10-r1 patch
Filename:
MIME Type:
Creator:
Roy Marples (RETIRED)
Created:
2005-11-14 10:20:29 UTC
Size:
10.30 KB
patch
obsolete
>Index: src/env_whitelist >=================================================================== >--- /lib/rcscripts/conf.d/env_whitelist (revision 1614) >+++ src/env_whitelist (working copy) >@@ -8,10 +8,13 @@ > # NB: Do not modify below this line if you do not know what you are doing!! > # > >-# Hotplug ? >-IN_BACKGROUND >+# Hotplug > IN_HOTPLUG > >+# RC network script support >+IN_BACKGROUND >+RC_INTERFACE_KEEP_CONFIG >+ > # Default shell stuff > SHELL > USER >Index: net-scripts/net.modules.d/arping >=================================================================== >--- /lib/rcscripts/net.modules.d/arping (revision 1614) >+++ net-scripts/net.modules.d/arping (working copy) >@@ -87,6 +87,11 @@ > eoutdent > veinfo "Configuring ${iface} for ${x}" > configure_variables "${iface}" "${conf}" >+ >+ # Call the system module as we've aleady passed it by .... >+ # And it *has* to be pre_start for other things to work correctly >+ system_pre_start "${iface}" >+ > eval config=( \"\$\{config_${ifvar}\[@\]\}\" ) > eval fallback_config=( \"\$\{fallback_config_${ifvar}\[@\]\}\" ) > eval fallback_route=( \"\$\{fallback_route_${ifvar}\[@\]\}\" ) >Index: net-scripts/net.modules.d/system >=================================================================== >--- /lib/rcscripts/net.modules.d/system (revision 1614) >+++ net-scripts/net.modules.d/system (working copy) >@@ -6,7 +6,8 @@ > # > # Sets up the dependancies for the module > system_depend() { >- after interface dhcp >+ after interface >+ before dhcp > variables dns_servers dns_domain dns_options dns_search dns_sortlist \ > ntp_servers nis_domain nis_servers > } >@@ -122,7 +123,7 @@ > # > # Configures the host system for dns, ntp and nis information > # Always returns 0 >-system_post_start() { >+system_pre_start() { > local iface="$1" > > system_dns "${iface}" >Index: net-scripts/net.modules.d/ifconfig >=================================================================== >--- /lib/rcscripts/net.modules.d/ifconfig (revision 1614) >+++ net-scripts/net.modules.d/ifconfig (working copy) >@@ -394,6 +394,24 @@ > return ${r} > } > >+# void ifconfig_route_metric(char* interface, int metric) >+# >+# Change all routes for an interface to a given metric >+ifconfig_route_metric() { >+ local dest gateway mask flags metric ref use >+ route -n | grep " $1$" | { >+ while read dest gateway mask flags metric ref use ; do >+ if [[ ${gateway} != "0.0.0.0" ]]; then >+ gateway="gw ${gateway}" >+ else >+ unset gateway >+ fi >+ route del ${dest} >+ route add -net ${dest} netmask ${mask} ${gateway} metric "$2" dev "$1" >+ done >+ } >+} >+ > # void ifconfig_default_route(char* interface, char* gateway_ip, int metric) > # > # Force default route to the specified gateway >Index: net-scripts/net.modules.d/helpers.d/pppd-wrapper >=================================================================== >--- /lib/rcscripts/net.modules.d/helpers.d/pppd-wrapper (revision 0) >+++ net-scripts/net.modules.d/helpers.d/pppd-wrapper (revision 0) >@@ -0,0 +1,42 @@ >+#!/bin/bash >+# Copyright (c) 2005 Gentoo Foundation >+# Distributed under the terms of the GNU General Public License v2 >+ >+# Contributed by Roy Marples (uberlord@gentoo.org) >+ >+action="$1" >+interface="$2" >+export IN_BACKGROUND="true" >+. /lib/rcscripts/net.modules.d/helpers.d/module-loader >+resolv="${statedir}/${interface}/resolv.conf" >+ >+if [[ ${action} == "up" ]]; then >+ if [[ -n ${DNS1} || -n ${DNS2} ]]; then >+ echo "# Generated by pppd for interface $1" > "${resolv}" >+ chmod 0644 "${resolv}" >+ [ -n ${DNS1} ] && echo "nameserver ${DNS1}" >> "${resolv}" >+ [ -n ${DNS2} ] && echo "nameserver ${DNS2}" >> "${resolv}" >+ fi >+ >+ # Calculate the metric for our routes >+ ifvar=$( bash_variable "${interface}" ) >+ eval metric=\"\$\{metric_${ifvar}\}\" >+ if [[ -z ${metric} ]]; then >+ if [[ ${RC_AUTO_INTERFACE} == "yes" ]]; then >+ metric=$( calculate_metric "${interface}" ) >+ else >+ metric="0" >+ fi >+ eval metric_${ifvar}="${metric}" >+ fi >+ >+ [[ ${metric} != "0" ]] && interface_route_metric "${interface}" "${metric}" >+ >+ export RC_INTERFACE_KEEP_CONFIG="yes" >+ /etc/init.d/net."${interface}" start >+else >+ rm -f "${resolv}" >+ /etc/init.d/net."${interface}" stop >+fi >+ >+# vim:ts=4 > >Property changes on: net-scripts/net.modules.d/helpers.d/pppd-wrapper >___________________________________________________________________ >Name: svn:executable > + * > >Index: net-scripts/net.modules.d/helpers.d/functions >=================================================================== >--- /lib/rcscripts/net.modules.d/helpers.d/functions (revision 1614) >+++ net-scripts/net.modules.d/helpers.d/functions (working copy) >@@ -96,21 +96,19 @@ > # (ie a state dir exists) > # require_gateway defaults to false > order_interfaces() { >- local ifaces >- >- if [[ ${1:-false} == "true" ]]; then >- ifaces=$(awk '$2!="Gateway" { print $7, $1 }' /proc/net/route \ >+ local ifaces extra >+ >+ ${1:-false} && extra=' && $2=="00000000"' >+ ifaces=$(awk '{if (NR>1 && $1!="lo"'"${extra}"') print $7, $1}' /proc/net/route \ > | sort -n | cut -d' ' -f2 | uniq) >- else >- ifaces=$(awk '$2=="00000000" { print $7, $1 }' /proc/net/route \ >- | sort -n | cut -d' ' -f2 ) >- fi > > # Append lo if it's up >- if grep -q "^lo[ \t]*" /proc/net/route ; then >- ifaces="${ifaces} lo" >+ if ! ${1:-false} ; then >+ if grep -q "^lo[ \t]*" /proc/net/route ; then >+ ifaces="${ifaces} lo" >+ fi > fi >- >+ > local i order > for i in ${ifaces}; do > [[ -d "${statedir}/${i}" ]] && order="${order}${i} " >@@ -132,7 +130,7 @@ > [[ ! -e "${statedir}/${ifaces[i]}/resolv.conf" ]] && unset ifaces[i] > done > ifaces=( "${ifaces[@]}" ) >- >+ > # No point merging unless there are two or more interfaces > [[ ${#ifaces[@]} -lt 2 ]] && return > >@@ -151,7 +149,7 @@ > opts[i]=$( sed -n -e 's/^[ \t]*options[ \t]*\([^#]*\).*/\1#/p;' "${f}" | xargs ) > sortlist[i]=$( sed -n -e 's/^[ \t]*sortlist[ \t]*\([^#]*\).*/\1/p' "${f}" ) > >- if [[ -z ${srvs[i]} && -z ${opts[i]} && -z ${sortlist[i]} ]]; then >+ if [[ -z ${srvs[i]} && -z ${opts[i]} && -z ${sortlist[i]} && -z ${search[i]} ]]; then > unset srvs[i] > unset search[i] > unset opts[i] >Index: net-scripts/net.modules.d/pppd >=================================================================== >--- /lib/rcscripts/net.modules.d/pppd (revision 1614) >+++ net-scripts/net.modules.d/pppd (working copy) >@@ -16,8 +16,8 @@ > # Returns 1 if pppd is installed, otherwise 0 > pppd_check_installed() { > if [[ ! -x /usr/sbin/pppd ]]; then >- ${1:-false} && eerror "For PPP support, emerge net-dialup/ppp" >- return 1 >+ ${1:-false} && eerror "For PPP support, emerge net-dialup/ppp" >+ return 1 > fi > return 0 > } >@@ -101,6 +101,8 @@ > # > # Returns 0 (true) when successful, otherwise 1 > pppd_start() { >+ ${IN_BACKGROUND} && return 0 >+ > local iface="$1" ifvar=$( bash_variable "$1" ) opts="" link > if [[ ${iface%%[0-9]*} != "ppp" ]]; then > eerror "PPP can only be invoked from net.ppp[0-9]" >@@ -114,8 +116,8 @@ > fi > > # PPP requires a link to communicate over - normally a serial port >- # PPPoE communicates over ethernet >- # PPPoA communictes over ATM >+ # PPPoE communicates over Ethernet >+ # PPPoA communicates over ATM > # In all cases, the link needs to be available before we start PPP > eval link=\"\$\{link_${ifvar}\}\" > if [[ -z ${link} ]]; then >@@ -142,8 +144,8 @@ > # Load any commandline options > eval opts=\"\$\{pppd_${ifvar}\[@\]}\" > >- # We don't work if unit, no detach or linkname is set. >- for i in unit nodetach linkname ; do >+ # We don't work with these options set by the user >+ for i in unit nodetach linkname maxfail persist ; do > if [[ " ${opts} " == *" ${i} "* ]]; then > eerror "The option \"${i}\" is not allowed" > return 1 >@@ -215,25 +217,39 @@ > #Specialized stuff. Insert here actions particular to connection type (pppoe,pppoa,capi) > local insert_link_in_opts=1 > if [[ " ${opts} " == *" plugin rp-pppoe.so "* ]]; then >+ if [[ ! -e /proc/net/pppoe ]]; then >+ # Load the pppoe kernel module >+ if ! modprobe pppoe 2>/dev/null ; then >+ eerror "Your kernel does not support pppoe" >+ return 1 >+ fi >+ fi >+ > # Ensure that the link exists and is up > interface_exists "${link}" true || return 1 > interface_up "${link}" > >- # Load the pppoe kernel module - if this fails, we have to hope >- # that pppoe support is compiled into the kernel >- modprobe pppoe 2>/dev/null >+ insert_link_in_opts=0 >+ fi > >- insert_link_in_opts=0 >+ if [[ " ${opts} " == *" plugin pppoatm.so "* ]]; then >+ # Load the kernell pppoa module >+ # AFAIK there is no way of knowing if pppoatm is available via /proc :/ >+ modprobe pppoatm 2>/dev/null > fi > [[ ${insert_link_in_opts} -eq 0 ]] || opts="${link} ${opts}" > > ebegin "Running pppd" >+ [[ " ${opts} " != *" updetach "* ]] && mark_service_inactive "net.${iface}" > i=$( eval /usr/sbin/pppd ${opts} 2>&1 ) > eend $? "${i}" || return 1 > > if [[ " ${opts} " == *" updetach "* ]]; then > local addr=$( interface_get_address "${iface}" ) > einfo "${iface} received address ${addr}" >+ else >+ einfo "Backgrounding ..." >+ exit 0 > fi > } > >@@ -244,6 +260,7 @@ > # Returns 0 (true) if no process to kill or it terminates successfully, > # otherwise non-zero (false) > pppd_stop() { >+ ${IN_BACKGROUND} && return 0 > local iface="$1" pidfile="/var/run/ppp-$1.pid" > > [[ ! -s ${pidfile} ]] && return 0 >Index: net-scripts/net.modules.d/iproute2 >=================================================================== >--- /lib/rcscripts/net.modules.d/iproute2 (revision 1614) >+++ net-scripts/net.modules.d/iproute2 (working copy) >@@ -309,9 +309,9 @@ > > # Support net-tools routing too > x="${x//gw/via}" >- x="${x//-A inet6}" >- x="${x//-net}" >- [[ " ${x} " == *" -host "* ]] && x="${x//-host} scope host" >+ x="${x//-A inet6/}" >+ x="${x//-net/}" >+ [[ " ${x} " == *" -host "* ]] && x="${x//-host/} scope host" > > # Attempt to support net-tools route netmask option > netmask="${x##* netmask }" >@@ -334,6 +334,19 @@ > return 0 > } > >+# void iproute2_route_metric(char* interface, int metric) >+# >+# Change all routes for an interface to a given metric >+iproute2_route_metric() { >+ local route >+ ip route | grep " dev $1" | { >+ while read route ; do >+ ip route del ${route} >+ ip route add ${route} metric "$2" >+ done >+ } >+} >+ > # void iproute2_default_route(char* interface, char* gateway_ip, int metric) > # > # Force default route to the specified gateway, optionally on
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 112049
:
72560
|
72561
|
72573
|
72605
|
72608
|
72644
|
72645
|
72807
|
72808
|
72809
|
72810
|
72868
|
72885
|
72938
|
72992
|
73062
|
73143