init script doesn't work correctly with multiple IPs on the external interface

Bug #1481735 reported by Nathan Rennie-Waldock
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
miniupnpd (Debian)
Fix Released
Unknown
miniupnpd (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Parts of the init script fail if the external interface has multiple IPs assigned.

systemctl status output:

   CGroup: /system.slice/miniupnpd.service
           └─29951 /usr/sbin/miniupnpd -i eth0 -o 5.xxx.xxx.xxx 51.xxx.xxx.xxx 51.xxx.xxx.xxx -a tap1 -N -f /etc/miniupnpd/miniupnpd.conf

Aug 05 12:46:35 miniupnpd[29926]: Bad argument `51.xxx.xxx.xxx'
Aug 05 12:46:35 miniupnpd[29926]: Try `iptables -h' or 'iptables --help' for more information.
Aug 05 12:46:35 miniupnpd[29926]: * Starting UPnP devices daemon MiniUPnPd
Aug 05 12:46:35 miniupnpd[29926]: Unknown option: 51.xxx.xxx.xxx
Aug 05 12:46:35 miniupnpd[29926]: Unknown option: 51.xxx.xxx.xxx
Aug 05 12:46:35 miniupnpd[29951]: HTTP listening on port 42522
Aug 05 12:46:35 miniupnpd[29951]: HTTP IPv6 address given to control points : [2001:41d0:8:xxxx::]
Aug 05 12:46:35 miniupnpd[29951]: Listening for NAT-PMP/PCP traffic on port 5351
Aug 05 12:46:35 systemd[1]: Started LSB: daemon providing UPnP Internet Gateway Device (IGD) services.
Aug 05 12:46:35 miniupnpd[29926]: ...done.

The problem is this line:
EXTIP="$(LC_ALL=C ${IP} addr show ${MiniUPnPd_EXTERNAL_INTERFACE} | grep "inet " | awk '{ print $2 }' | cut -d"/" -f1)"
It should be changed to (preferably with another variable in /etc/default/miniupnpd to override it):
EXTIP="$(LC_ALL=C ${IP} addr show ${MiniUPnPd_EXTERNAL_INTERFACE} | grep -m1 "inet " | awk '{ print $2 }' | cut -d"/" -f1)"

Or, according to the manpage it could be removed (to use the default address) and leave a variable to override it.
       -o address
              address used to connect to the internet. default address of the interface will be used if not specified.

Tags: vivid
Yangfl (mmyangfl)
information type: Public → Public Security
information type: Public Security → Public
Changed in miniupnpd (Debian):
status: Unknown → New
Changed in miniupnpd (Debian):
status: New → Fix Released
Yangfl (mmyangfl)
Changed in miniupnpd (Ubuntu):
status: New → Incomplete
Yangfl (mmyangfl)
Changed in miniupnpd (Ubuntu):
status: Incomplete → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.