Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Mar 2002 09:45:45 -0500
From:      "Haiwei Chan" <backend@mail.com>
To:        freebsd-net@freebsd.org
Subject:   error handling in in_ifinit()
Message-ID:  <20020322144545.35863.qmail@mail.com>

next in thread | raw e-mail | index | archive | help

In the newest 4-stable kernel whose source codes are synchronized by cvsup,
it would fail if trying to add an alias address whose network and netmask
are the same as the orignal one on that network interface:

# uname -a
FreeBSD intra.example.com 4.5-STABLE FreeBSD 4.5-STABLE #5: Fri Mar 22
13:45:41 CST 2002    root@intra.example.com:/usr/src/sys/compile/SERVER i386
# ifconfig xl0 inet 192.168.1.100 netmask 0xffffff00
# ifconfig xl0 inet 192.168.1.101 netmask 0xffffff00 alias
ifconfig: ioctl (SIOCDIFADDR): File exists

But it worked for 4.4-Release (I'd tested):

#uname -a
FreeBSD bsd.example.com 4.4-RELEASE FreeBSD 4.4-RELEASE # 17: Fri Mar 22
12:09:36 CST 2002    root@bsd.example.com:/usr/src/sys/compile/SERVER i386
# ifconfig xl0 inet 192.168.1.100 netmask 0xffffff00
# ifconfig xl0 inet 192.168.1.101 netmask 0xffffff00 alias
# ifconfig xl0
xl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        options=3<rxcsum,txcsum>
        inet 192.168.1.100 netmask 0xffffff00 broadcast 192.168.1.255
        inet6 fe80::201:2ff:fe80:2a8b%xl0 prefixlen 64 scopeid 0x2 
        inet 192.168.1.101 netmask 0xffffff00 broadcast 255.255.255.0
        ether 00:01:02:80:2a:8b 
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active


Below is a workground patch:

[root@www /sys/netinet]# diff -u in.c.orig in.c 
--- in.c.orig   Fri Mar 22 13:16:07 2002
+++ in.c        Fri Mar 22 13:16:41 2002
@@ -737,7 +737,8 @@
         * interface, because the bootp code wants to set a 0.0.0.0/0
         * address on all interfaces. Disable the check when bootp is used.
         */
-       if (error != 0 && ia->ia_dstaddr.sin_family == AF_INET) {
+       if (error != 0 && error != EEXIST &&
+           ia->ia_dstaddr.sin_family == AF_INET) {
                ia->ia_addr = oldaddr;
                return (error);
        }

Should it be done so?

-- 

_______________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

Win the Ultimate Hawaiian Experience from Travelocity.
http://ad.doubleclick.net/clk;4018363;6991039;n?http://svc.travelocity.com/promos/winhawaii/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020322144545.35863.qmail>