Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261322AbTESSFO (ORCPT ); Mon, 19 May 2003 14:05:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261624AbTESSFO (ORCPT ); Mon, 19 May 2003 14:05:14 -0400 Received: from chaos.analogic.com ([204.178.40.224]:1664 "EHLO chaos.analogic.com") by vger.kernel.org with ESMTP id S261322AbTESSFN (ORCPT ); Mon, 19 May 2003 14:05:13 -0400 Date: Mon, 19 May 2003 14:18:04 -0400 (EDT) From: "Richard B. Johnson" X-X-Sender: root@chaos Reply-To: root@chaos.analogic.com To: Denis Zaitsev cc: linux-kernel@vger.kernel.org Subject: Re: Impossible to turn BROADCAST mode off on ethernet device? In-Reply-To: <20030519225656.A6998@natasha.zzz.zzz> Message-ID: References: <20030519225656.A6998@natasha.zzz.zzz> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1781 Lines: 63 On Mon, 19 May 2003, Denis Zaitsev wrote: > Kernel 2.4.20. I do: > > ifconfig eth0 -broadcast > > And BROADCAST isn't turned off... The ethernet modules are: eepro100, > tulip, 3c59x. So, what does it mean? > > Thanks in advance. Your `ifconfig` might not allow broadcast to be turned off as long a eth0 is `up`. So I just made a little program to get the flags, and reset the flags. This shows that your observation is, indeed, correct. If you mess around with this, I think you will find that you can't set broadcast OFF as long at the IFF_UP flag is set. This may be the required behavior because an interface without broadcast capability will not work on ethernet because ARP requires it. #include #include #include #include #include #include #include #include int main() { struct ifreq ifr; int s, status; if((s = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)) == -1) { fprintf(stderr, "socket() failed (%s)\n", strerror(errno)); return s; } memset(&ifr, 0x00, sizeof(ifr)); ifr.ifr_netmask.sa_family = AF_INET; strcpy(ifr.ifr_name, "eth0"); status = ioctl(s, SIOCGIFFLAGS, &ifr); ifr.ifr_flags &= ~IFF_BROADCAST; status = ioctl(s, SIOCGIFFLAGS, &ifr); (void)close(s); return status; } Cheers, Dick Johnson Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips). Why is the government concerned about the lunatic fringe? Think about it. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/