Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 392614 Details for
Bug 533888
net-misc/minissdpd-1.3 - /etc/init.dminissdpd expects old ifconfig output style
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Update minissdpd init script to detect interfaces correctly
file_533888.txt (text/plain), 2.64 KB, created by
Christohper Harrington
on 2014-12-29 05:43:09 UTC
(
hide
)
Description:
Update minissdpd init script to detect interfaces correctly
Filename:
MIME Type:
Creator:
Christohper Harrington
Created:
2014-12-29 05:43:09 UTC
Size:
2.64 KB
patch
obsolete
>--- /etc/init.d/minissdpd.old 2014-12-28 19:59:04.344867561 -0600 >+++ /etc/init.d/minissdpd 2014-12-28 23:11:53.714998895 -0600 >@@ -3,30 +3,34 @@ > MINISSDPD="/usr/sbin/minissdpd" > PIDFILE="/var/run/minissdpd.pid" > >-ROUTE="/bin/route" >-IFCONFIG="/bin/ifconfig" >- > depend() { > need net > before miniupnpd > } > >+interfaceup() { >+ # interface exists? >+ if [ ! -f /sys/class/net/$1/flags ]; then return 1; fi >+ let "IFUP = `cat /sys/class/net/$1/flags` & 1" >+ # interface has UP flag? >+ if [ $IFUP -eq 0 ]; then return 1; fi >+ return 0 >+} >+ >+# awk script: scans the /proc routing table for local subnets >+# 1. filter list for entries with a gateway (column 3) of 0.0.0.0 (ie interface-local) >+# 2. read column 2 for network-order hex encoded subnet address >+# 3. match against a 10.x.x.x, 172.(16-31).x.x, or 192.168.x.x address >+# 4. print out any interface (column 1) that matches >+privateinterfaces() { >+ awk -f - /proc/net/route <<'FindPrivateNetworks' >+function p(m,n) { return(and(IP,m) == n); } >+$3=="00000000" { IP=strtonum("0x"$2); if (p(0xff,0x0a) || p(0x1fff,0x10ac) || p(0xffff,0xa8c0)) print $1; } >+FindPrivateNetworks >+} >+ > checkconfig() { >- if [ "x$MINISSDPD_IFACE" != "x" ]; then >- interfaces=$($IFCONFIG | grep "Link encap" | awk '{ print $1 }') >- for interface in $MINISSDPD_IFACE; do >- hit=0 >- for available in $interfaces; do >- if [ "$interface" = "$available" ]; then >- hit=1 >- fi >- done >- if [ $hit = 0 ]; then >- ewarn "Interface $interface not available" >- return 1 >- fi >- done >- fi >+ # no-op > return 0 > } > >@@ -34,22 +38,24 @@ > ebegin "Starting minissdpd" > checkconfig || return 1 > >+ ARGS="" > if [ "x$MINISSDPD_IFACE" = "x" ]; then >- # We assume that the default interface has an IP address >- interface=$($ROUTE | grep default | awk -- '{ print $8 }') >- IP="$($IFCONFIG $interface | grep 'inet' | sed 's/^.*inet \([0-9.]\+\).\+/\1/')" >- ARGS="-i $IP " >+ ewarn "No interfaces provided, using interfaces on private networks" >+ IFLIST=$(privateinterfaces) > else >- ARGS="" >- for interface in $MINISSDPD_IFACE; do >- # An interface may not have an IP address, so don't listen if it doesn't >- IP="$($IFCONFIG $interface | grep 'inet' | sed 's/^.*inet \([0-9.]\+\).\+/\1/')" >- if [ "x$IP" != "x" ]; then >- ARGS+="-i $IP " >- fi >- done >+ IFLIST="$MINISSDPD_IFACE" > fi > >+ eindent >+ for IF in $IFLIST; do >+ if interfaceup $IF; then >+ einfo Adding interface $IF >+ ARGS+="-i $IF " >+ else >+ ewarn "Interface $IF is not up" >+ fi >+ done >+ eoutdent > start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $MINISSDPD -- $ARGS > eend $? > }
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 533888
: 392614