Re: promisc coding question

From: George V. Neville-Neil (gnn_at_neville-neil.com)
Date: 09/25/04

  • Next message: Yuri A. Mischenko: "test"
    Date: Sat, 25 Sep 2004 12:07:00 +0900
    To: ming fu <fming@borderware.com>
    
    

    At Fri, 24 Sep 2004 08:30:13 -0400,
    ming fu wrote:
    >
    > Hi,
    >
    > in if.h
    > #define IFF_PROMISC 0x100 /* receive all packets */
    > #define IFF_PPROMISC 0x20000 /* user-requested promisc mode */
    >
    > Do I have to set both on for the promisc to work?
    > If I only need one of them, then what is the difference?
    >

    The first flag (IFF_PROMISC) is the one that the kernel code uses and
    sets on an interface's ifp structure. The second one is the one that
    comes from user space programs and is sent to the routine ifhwioctl()
    to set the first flag.

    Having reviewed this flags usage I believe that there are at least two
    bugs in the kernel related to its handling:

    I beleieve it is only used correctly at:

    if.c[1160] if (new_flags & IFF_PPROMISC) {

    but that at:

    if.c[1478] if (ifp->if_flags & IFF_PPROMISC) {

    and

    if_ethersubr.c[664] && (ifp->if_flags & IFF_PPROMISC)== 0) {

    neither of those checks can ever succeed because I can find nowhere in
    the code that the IFF_PPROMISCx flag is set on an interface. I suggest
    two changes to remedy this:

    1) Change IFF_PPROMISC to IFF_USERPROMISC to disambiguate the names.

    2) Change if.c[1478] and if_ethersubr.c[664] to check for the correct
       flag, IFF_PROMISC.

    Or, someone can tell me that I'm wrong :-)

    I will send out a patch next.

    Later,
    George
    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"


  • Next message: Yuri A. Mischenko: "test"

    Relevant Pages

    • Re: NTP leap second question
      ... > the packet header and pretend they're actually 00. ... What I am asking is when is the flag sent to the kernel. ... the kernel code says that it will insert the second on the second roll ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: NTP leap second question
      ... >>What I am asking is when is the flag sent to the kernel. ... >>the kernel code says that it will insert the second on the second roll ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Suspected bug infilesystems (UFS,ADFS,BEFS,BFS,ReiserFS) related to sector_t being unsigned, adv
      ... >>Also just reading manpage on gcc around description of that flag will ... >>give you a list of options to individually turn on certain check types. ... Both on kernel code and progs code. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • EXT2_COMPR_FL flag in the i_flags field of the inode
      ... Has anyone played around with the EXT2_COMPR_FL flag ... in the i_flags field of the inode? ... inform the OS to use some compression/decompression ... tried writing any kernel code using this flag? ...
      (alt.os.linux)
    • Re: Serial driver changes from v5 to v7
      ... denotes a boundary between capabilities so you can't just insert one ... will make it try to find the tty setting for a flag " -icanon", ... realize that the first flag on a continuation line will be ignored (you ...
      (comp.unix.bsd.freebsd.misc)