Package: arping
Version: 2.05-2
Severity: wishlist
Tags: patch

Attached patch adds a network/ip-up.d script that uses arping to check for
IP duplicates after bringing up the interface.  If the IP we're bringing up
is already taken, this brings the interface down.

Note that duplicate IPs can be very harmful and even cause loss of data.  For
example, if you setup a mailserver with the IP of another mail server by
mistake, your host might get to receive all incoming mail attempts, rejecting
them with permanent errors and causing massive loss of mail.

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-686
Locale: LANG=ca_ES.UTF-8, LC_CTYPE=ca_ES.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to ca_ES.UTF-8)

Versions of packages arping depends on:
ii  libc6                       2.3.6.ds1-13 GNU C Library: Shared libraries
ii  libnet1                     1.1.2.1-2    library for the construction and h
ii  libpcap0.8                  0.9.5-1      System interface for user-level pa
ii  lsb-base                    3.1-23.1     Linux Standard Base 3.1 init scrip

arping recommends no packages.

-- no debconf information
diff -Nur arping-2.05.old/debian/control arping-2.05/debian/control
--- arping-2.05.old/debian/control      2007-06-29 13:19:54.000000000 +0200
+++ arping-2.05/debian/control  2007-06-29 13:22:49.000000000 +0200
@@ -7,7 +7,7 @@
 
 Package: arping
 Architecture: any
-Depends: ${shlibs:Depends}
+Depends: ${shlibs:Depends}, lsb-base (>= 3.0-10)
 Conflicts: iputils-arping, iputils-ping (<< 20001110-6)
 Description: sends IP and/or ARP pings (to the MAC address)
  The arping utility sends ARP and/or ICMP requests to the specified host
diff -Nur arping-2.05.old/debian/if-up arping-2.05/debian/if-up
--- arping-2.05.old/debian/if-up        1970-01-01 01:00:00.000000000 +0100
+++ arping-2.05/debian/if-up    2007-06-29 13:26:03.000000000 +0200
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+. /lib/lsb/init-functions
+
+log_action_begin_msg "Using arping to check duplicity of ${IF_ADDRESS}"
+
+if arping -c 1 -d -I ${IFACE} ${IF_ADDRESS} > /dev/null ; then
+  ifconfig ${IFACE} down
+  msg="Another computer is already using ${IF_ADDRESS}"
+  status=1
+else
+  msg="No duplicates found"
+  status=0
+fi
+
+log_action_end_msg ${status} "${msg}"
+
+[ ${status} = 0 ]
diff -Nur arping-2.05.old/debian/rules arping-2.05/debian/rules
--- arping-2.05.old/debian/rules        2007-06-29 13:19:54.000000000 +0200
+++ arping-2.05/debian/rules    2007-06-29 13:28:13.000000000 +0200
@@ -27,9 +27,11 @@
        install -d debian/tmp/usr/sbin
        install -d debian/tmp/usr/share/doc/$(pkg)/examples
        install -d debian/tmp/usr/share/man/man8
+       install -d debian/tmp/etc/network/if-up.d
        install -m 0644 debian/copyright debian/tmp/usr/share/doc/$(pkg)
        install -sm 0755 $(pkg) debian/tmp/usr/sbin
        install -m 0755 arping-scan-net.sh 
debian/tmp/usr/share/doc/$(pkg)/examples
+       install -m 0755 debian/if-up debian/tmp/etc/network/if-up.d/arping
        gzip -9c README >debian/tmp/usr/share/doc/$(pkg)/README.gz
        gzip -9c debian/changelog 
>debian/tmp/usr/share/doc/$(pkg)/changelog.Debian.gz
        gzip -9c debian/README.Debian 
>debian/tmp/usr/share/doc/$(pkg)/README.Debian.gz

Reply via email to