~ubuntu-branches/ubuntu/trusty/ifupdown-extra/trusty

« back to all changes in this revision

Viewing changes to if-up-scripts/check-duplicate-ip

  • Committer: Bazaar Package Importer
  • Author(s): Javier Fernández-Sanguino Peña, Javier Fernández-Sanguino Peña
  • Date: 2011-10-14 00:38:29 UTC
  • Revision ID: james.westby@ubuntu.com-20111014003829-0e0hcr38xx3slgh6
Tags: 0.22
[ Javier Fernández-Sanguino Peña ]
* if-up-scripts/check-duplicate-ip:
   - Do not pass aliased interface information to arping since it cannot
     handle it properly (Closes: #644891)
* Handle the configuration file through the use of dpkg-maintscript-helper
  instead of moving it directly to prevent dpkg from raising a conffile
  change prompt on upgrades even if the user has          not made any
  changes. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
# Do not do the check if ethtool (if installed) tells us the interface
87
87
# does not have link, notice that ARPING will try to send the ARP requests
88
88
# even if there is no link so we use this to speed things up
 
89
 
 
90
# First determine physical interface in case aliased interfaces are used
 
91
        real_iface=`echo $IFACE | sed -e 's|:[[:digit:]]\+||'`
89
92
        if [ -x "$ETHTOOL" ] ; then
90
 
                LINK="`$ETHTOOL $IFACE 2>&1| grep \"Link[[:blank:]]\+detected:\"`"
 
93
                LINK="`$ETHTOOL $real_iface 2>&1| grep \"Link[[:blank:]]\+detected:\"`"
91
94
                if ! echo $LINK | grep -q "yes$" ; then
92
95
                        return
93
96
                fi
94
97
        fi
95
98
 
96
99
        for ADDR in $IF_ADDRESS; do
97
 
                [ "$VERBOSITY" -eq 1 ] && $OUTPUT "DEBUG: Sending arp pings through $IFACE to detect other systems using $ADDR"
98
 
                $ARPING -c $ARP_COUNT -w $ARP_TIMEOUT -D -I $IFACE $ADDR $ARPING_EXTRAOPTS
 
100
                [ "$VERBOSITY" -eq 1 ] && $OUTPUT "DEBUG: Sending arp pings through $real_iface (for $IFACE) to detect other systems using $ADDR"
 
101
                $ARPING -c $ARP_COUNT -w $ARP_TIMEOUT -D -I $real_iface $ADDR $ARPING_EXTRAOPTS
99
102
                if [ $? -ne 0 ] ; then
100
 
                    $OUTPUT "ERROR: Duplicate address $ADDR assigned in the network where $IFACE is connected to."
 
103
                    $OUTPUT "ERROR: Duplicate address $ADDR assigned in the network where $real_iface is connected to."
101
104
                fi
102
105
        done
103
106
}
110
113
}
111
114
 
112
115
if [ -z "$IFACE" ] ; then
113
 
    echo "ERROR: Do not know what interface to check. IFACE variable is not defined!" >&2
 
116
    echo "ERROR: Do not know what interface to check. IFACE environment variable is not defined!" >&2
114
117
    exit 1
115
118
fi
116
119