linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Impossible to turn BROADCAST mode off on ethernet device?
@ 2003-05-19 16:56 Denis Zaitsev
  2003-05-19 18:18 ` Richard B. Johnson
  0 siblings, 1 reply; 2+ messages in thread
From: Denis Zaitsev @ 2003-05-19 16:56 UTC (permalink / raw)
  To: linux-kernel

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Impossible to turn BROADCAST mode off on ethernet device?
  2003-05-19 16:56 Impossible to turn BROADCAST mode off on ethernet device? Denis Zaitsev
@ 2003-05-19 18:18 ` Richard B. Johnson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard B. Johnson @ 2003-05-19 18:18 UTC (permalink / raw)
  To: Denis Zaitsev; +Cc: linux-kernel

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 <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <string.h>
#include <net/if.h>

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-19 18:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-19 16:56 Impossible to turn BROADCAST mode off on ethernet device? Denis Zaitsev
2003-05-19 18:18 ` Richard B. Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).