On Wed, Dec 20, 2000 at 08:08:13AM +1100, Neale Banks wrote: > On Tue, 19 Dec 2000, Bernd Eckenfels wrote: > > [...] > > So, the question is, if we should fix the kernel or ifconfig. If i consider > > that the kernel now is calculating the broadcast absed on a class, i guess > > it is better to fix the kernel since CIDR will make it leaner. > > IMHO, the kernel is the "best" place to fix this as it's closer to the > action. Also, we shouldn't assume(1) that interfaces will only ever be > created via ifconfig. > > This strategy of course assume(1)s that the kernel is necessarily in > possession of the netmask when it's setting the broadcast address. > > Would we also need to consider obscure cases such as a netmask change > after the user has supplied a non-standard broadcast address? > > Questions: > > 1) where do I find this in the kernel (as in 2.2.x; preliminary > find-and-grepping hasn't helped much so far)? $ strace -e trace=ioctl ifconfig eth0:1 >/dev/null ioctl(4, SIOCGIFCONF, 0xbffff26c) = 0 ioctl(4, SIOCGIFFLAGS, 0xbffff454) = 0 ioctl(4, SIOCGIFHWADDR, 0xbffff454) = 0 ioctl(4, SIOCGIFMETRIC, 0xbffff454) = 0 ioctl(4, SIOCGIFMTU, 0xbffff454) = 0 ioctl(4, SIOCGIFMAP, 0xbffff454) = 0 ioctl(4, SIOCGIFMAP, 0xbffff454) = 0 ioctl(4, 0x8942, 0xbffff454) = 0 ioctl(4, SIOCGIFADDR, 0xbffff454) = 0 ioctl(4, SIOCGIFDSTADDR, 0xbffff454) = 0 ioctl(4, SIOCGIFBRDADDR, 0xbffff454) = 0 ioctl(4, SIOCGIFNETMASK, 0xbffff454) = 0 ioctl(1, TCGETS, 0xbfffeb90) = -1 ENOTTY (Inappropriate ioctl for device) ifconfig uses ioctls to configure an interface. See ioctl_list(2), especially the ioctls starting with SIOCSIF, for more details. $ man ioctl_list | grep SIOCSIF 0x00008911 SIOCSIFLINK void 0x00008914 SIOCSIFFLAGS const struct ifreq * 0x00008916 SIOCSIFADDR const struct ifreq * 0x00008918 SIOCSIFDSTADDR const struct ifreq * 0x0000891A SIOCSIFBRDADDR const struct ifreq * 0x0000891C SIOCSIFNETMASK const struct ifreq * 0x0000891E SIOCSIFMETRIC const struct ifreq * 0x00008920 SIOCSIFMEM const struct ifreq * 0x00008922 SIOCSIFMTU const struct ifreq * 0x00008924 SIOCSIFHWADDR const struct ifreq * I believe the problem is *not* with the kernel, which should provide mechanism, not policy. Rather, ifconfig needs to pass more appropriate values in the struct ifreq when issuing the SIOCSIFBRDADDR ioctl. Regarding where in the kernel this is handled, see: fs/ioctl.c:sys_ioctl() # the entry point for the system call - for a socket, this will execute the following line (2.4.0): else if (filp->f_op && filp->f_op->ioctl) error = filp->f_op->ioctl(filp->f_dentry->d_inode, filp, cmd, arg); net/socket.c:sock_ioctl() # the ioctl method pointed to by a socket's # struct file_operations - the following code calls the real ioctl method sock = socki_lookup(inode); err = sock->ops->ioctl(sock, cmd, arg); net/ipv4/devinet.c:devinet_ioctl() # where the real work is done Regards, Nick Dronen - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org