Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 170125 Details for
Bug 241120
New ebuild for miniupnpc from http://miniupnp.free.fr/
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
init.d script (see #c2)
miniupnpc-initd (text/plain), 1.73 KB, created by
Michał Górny
on 2008-10-28 16:29:15 UTC
(
hide
)
Description:
init.d script (see #c2)
Filename:
MIME Type:
Creator:
Michał Górny
Created:
2008-10-28 16:29:15 UTC
Size:
1.73 KB
patch
obsolete
>#!/sbin/runscript ># Copyright 1999-2008 Gentoo Foundation ># Distributed under the terms of the GNU General Public License v2 ># $Header: $ > >depend() { > need net >} > >source /lib/rc/net/iproute2.sh > >_checks() { > if [ -z "${IFACE}" ]; then > eerror 'You need to set $IFACE!' > return 1 > fi >} > >_flush_routes() { > while true; do > # using 'route' instead of 'ip route', because its output can be parsed easier > ROUTER="$(route -n | awk '$8 == "'"${IFACE}"'"&& $5 == "'"${METRIC}"'" && $1 == "0.0.0.0" && $2 != "0.0.0.0" { print $2 }')" > [ -z "${ROUTER}" ] && break > > ebegin "Disabling route through ${ROUTER}" > ip route del default via "${ROUTER}" dev "${IFACE}" # not provided by iproute2.sh > RET=$? > eend ${RET} > > [ ${RET} -ne 0 ] && return ${RET} > done >} > >start() { > _checks || return $? > _flush_routes || return $? # we really always want to clear old route 'in case' > > SSDPADDR="${SSDPADDR:-$(_get_inet_address)}" # upnpc > > if [ -z "${IFACE}" ]; then > eerror "I failed to determine IP of ${IFACE}. Please set \$SSDPADDR!" > return 1 > fi > > ebegin "Trying to find any router using UPnP" > eval "$(upnpc -m "${SSDPADDR%/*}" -s 2>/dev/null | perl -e ' > local $/; > <> =~ /Found valid IGD\s+:\s+http:\/\/([\d\.]{7,}).*?ExternalIPAddress = ([\d\.]{7,})/s > or exit 1; > print "ROUTER=$1; MYIP=$2" > ')" > > [[ $? -eq 0 && -n "${ROUTER}" && -n "${MYIP}" ]] > RET=$? > eend ${RET} > > if [ "${ROUTER}" = "${SSDPADDR%/*}" ]; then > eerror "Found UPnP router on local machine!" > return 1 > fi > > [ ${RET} -ne 0 ] && return ${RET} > > ebegin "Adding route through ${ROUTER}" > _add_route -net default via "${ROUTER}" metric "${METRIC}" # dev ${IFACE} implicit > RET=$? > eend ${RET} > > einfo "External IP: ${MYIP}" > > return ${RET} >} > >stop() { > _checks || return $? > _flush_routes > return $? >}
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 241120
:
167874
|
170125
|
170126
|
205360
|
246352