Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 4727 Details for
Bug 9160
Method to change the mac address on a nic
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Example of what I would like to see changed.
net.eth0 (text/plain), 3.83 KB, created by
Kenneth Rawlings
on 2002-10-15 08:31:31 UTC
(
hide
)
Description:
Example of what I would like to see changed.
Filename:
MIME Type:
Creator:
Kenneth Rawlings
Created:
2002-10-15 08:31:31 UTC
Size:
3.83 KB
patch
obsolete
>#!/sbin/runscript ># Copyright 1999-2002 Gentoo Technologies, Inc. ># Distributed under the terms of the GNU General Public License, v2 or later ># $Header: /home/cvsroot/gentoo-src/rc-scripts/init.d/net.eth0,v 1.17 2002/09/07 13:31:29 azarah Exp $ > >#NB: Config is in /etc/conf.d/net > > ># For pcmcia users. note that pcmcia must be added to the same ># runlevel as the net.* script that needs it. >depend() { > use pcmcia >} > >checkconfig() { > if [ -z "$(eval echo \$\{iface_${IFACE}\})" ] > then > eerror "Please make sure that /etc/conf.d/net has \$iface_$IFACE set" > return 1 > fi >} > >start() { > checkconfig || return 1 > local iface_args="$(eval echo \$\{iface_${IFACE}\})" > local dhcp_args="$(eval echo \$\{dhcpcd_${IFACE}\})" > local mac_args="$(eval echo \$\{mac_${IFACE}\})" > local retval=0 > ebegin "Bringing ${IFACE} up" > if [ -n "$(eval echo \$\{mac_${IFACE}\})" ] > then > /sbin/ifconfig ${IFACE} ${mac_args} >/dev/null || { > retval=$? > eend ${retval} "Failed to set new MAC address on ${IFACE}" > return ${retval} > } > fi > if [ "$(eval echo \$\{iface_${IFACE}\})" != "dhcp" ] > then > /sbin/ifconfig ${IFACE} ${iface_args} >/dev/null || { > retval=$? > eend ${retval} "Failed to bring ${IFACE} up" > return ${retval} > } > else > /sbin/dhcpcd ${dhcp_args} ${IFACE} >/dev/null || { > retval=$? > eend ${retval} "Failed to bring ${IFACE} up" > return ${retval} > } > fi > eend 0 > > if [ -n "$(eval echo \$\{alias_${IFACE}\})" ] > then > local x="" > local num=0 > local aliasbcast="" > local aliasnmask="" > > ebegin " Adding aliases" > for x in $(eval echo \$\{alias_${IFACE}\}) > do > aliasbcast="$(eval echo \$\{broadcast_${IFACE}\} \| awk \'\{ print \$${num} \}\')" > if [ -n "${aliasbcast}" ] > then > aliasbcast="broadcast ${aliasbcast}" > fi > > aliasnmask="$(eval echo \$\{netmask_${IFACE}\} \| awk \'\{ print \$${num} \}\')" > if [ -n "${aliasnmask}" ] > then > aliasnmask="netmask ${aliasnmask}" > fi > > ebegin " ${IFACE}:${num}" > /sbin/ifconfig ${IFACE}:${num} ${x} \ > ${aliasbcast} ${aliasnmask} >/dev/null > num=$((num + 1)) > eend 0 > done > save_options "alias" "$(eval echo \$\{alias_${IFACE}\})" > fi > > if [ -n "$(eval echo \$\{inet6_${IFACE}\})" ] > then > local x="" > ebegin " Adding inet6 addresses" > for x in $(eval echo \$\{inet6_${IFACE}\}) > do > ebegin " ${IFACE} inet6 add ${x}" > /sbin/ifconfig ${IFACE} inet6 add ${x} >/dev/null > eend 0 > done > save_options "inet6" "$(eval echo \$\{inet6_${IFACE}\})" > fi > > if [ -n "${gateway}" ] && [ "${gateway%/*}" = "${IFACE}" ] > then > ebegin " Setting default gateway" > /sbin/route add default gw ${gateway#*/} dev ${gateway%/*} \ > netmask 0.0.0.0 metric 1 >/dev/null || { > > local error=$? > ifconfig ${IFACE} down &>/dev/null > eend ${error} "Failed to bring ${IFACE} up" > return ${error} > } > eend 0 > fi > > # Enabling rp_filter causes wacky packets to be auto-dropped by > # the kernel > if [ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter ] > then > echo 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter > fi >} > >stop() { > local myalias="$(get_options alias)" > ebegin "Bringing ${IFACE} down" > > # Also down the inet6 interfaces > local myinet6="$(get_options inet6)" > if [ -n "${myinet6}" ] > then > local x="" > for x in ${myinet6} > do > /sbin/ifconfig ${IFACE} inet6 del ${x} >/dev/null > done > fi > > # Do some cleanup in case the amount of aliases change > if [ -n "${myalias}" ] > then > local x="" > local num=0 > for x in ${myalias} > do > /sbin/ifconfig ${IFACE}:${num} down >/dev/null > num=$((num + 1)) > done > fi > > if [ "$(eval echo \$\{iface_${IFACE}\})" == "dhcp" ] > then > /sbin/dhcpcd -k ${IFACE} &>/dev/null > > # Give dhcpcd time to properly shutdown > local count=0 > einfon " Waiting for dhcpcd to shutdown" > while [ "${count}" -lt 5 ] > do > echo -n "." > sleep 1 > count=$((count + 1)) > done > echo "done" > else > /sbin/ifconfig ${IFACE} down >/dev/null > fi > eend 0 >} > > ># vim:ts=4
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 Raw
Actions:
View
Attachments on
bug 9160
: 4727