06 Dec, 2016

1 commit

  • Fix a wrong condition preventing the higher net device flags
    IFF_LOWER_UP etc to be defined if net/if.h is included before
    linux/if.h.

    The comment makes it clear the intention was to allow partial
    definition with either parts.

    This fixes compilation of userspace programs trying to use
    IFF_LOWER_UP, IFF_DORMANT or IFF_ECHO.

    Fixes: 4a91cb61bb99 ("uapi glibc compat: fix compile errors when glibc net/if.h included before linux/if.h")
    Signed-off-by: Jonas Gorski
    Reviewed-by: Mikko Rapeli
    Signed-off-by: David S. Miller

    Jonas Gorski
     

10 May, 2016

1 commit

  • glibc's net/if.h contains copies of definitions from linux/if.h and these
    conflict and cause build failures if both files are included by application
    source code. Changes in uapi headers, which fixed header file dependencies to
    include linux/if.h when it was needed, e.g. commit 1ffad83d, made the
    net/if.h and linux/if.h incompatibilities visible as build failures for
    userspace applications like iproute2 and xtables-addons.

    This patch fixes compile errors when glibc net/if.h is included before
    linux/if.h:

    ./linux/if.h:99:21: error: redeclaration of enumerator ‘IFF_NOARP’
    ./linux/if.h:98:23: error: redeclaration of enumerator ‘IFF_RUNNING’
    ./linux/if.h:97:26: error: redeclaration of enumerator ‘IFF_NOTRAILERS’
    ./linux/if.h:96:27: error: redeclaration of enumerator ‘IFF_POINTOPOINT’
    ./linux/if.h:95:24: error: redeclaration of enumerator ‘IFF_LOOPBACK’
    ./linux/if.h:94:21: error: redeclaration of enumerator ‘IFF_DEBUG’
    ./linux/if.h:93:25: error: redeclaration of enumerator ‘IFF_BROADCAST’
    ./linux/if.h:92:19: error: redeclaration of enumerator ‘IFF_UP’
    ./linux/if.h:252:8: error: redefinition of ‘struct ifconf’
    ./linux/if.h:203:8: error: redefinition of ‘struct ifreq’
    ./linux/if.h:169:8: error: redefinition of ‘struct ifmap’
    ./linux/if.h:107:23: error: redeclaration of enumerator ‘IFF_DYNAMIC’
    ./linux/if.h:106:25: error: redeclaration of enumerator ‘IFF_AUTOMEDIA’
    ./linux/if.h:105:23: error: redeclaration of enumerator ‘IFF_PORTSEL’
    ./linux/if.h:104:25: error: redeclaration of enumerator ‘IFF_MULTICAST’
    ./linux/if.h:103:21: error: redeclaration of enumerator ‘IFF_SLAVE’
    ./linux/if.h:102:22: error: redeclaration of enumerator ‘IFF_MASTER’
    ./linux/if.h:101:24: error: redeclaration of enumerator ‘IFF_ALLMULTI’
    ./linux/if.h:100:23: error: redeclaration of enumerator ‘IFF_PROMISC’

    The cases where linux/if.h is included before net/if.h need a similar fix in
    the glibc side, or the order of include files can be changed userspace
    code as a workaround.

    This change was tested in x86 userspace on Debian unstable with
    scripts/headers_compile_test.sh:

    $ make headers_install && \
    cd usr/include && ../../scripts/headers_compile_test.sh -l -k
    ...
    cc -Wall -c -nostdinc -I /usr/lib/gcc/i586-linux-gnu/5/include -I /usr/lib/gcc/i586-linux-gnu/5/include-fixed -I . -I /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.2uX2zH -I /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.2uX2zH/i586-linux-gnu -o /dev/null ./linux/if.h_libc_before_kernel.h
    PASSED libc before kernel test: ./linux/if.h

    Reported-by: Jan Engelhardt
    Reported-by: Josh Boyer
    Reported-by: Stephen Hemminger
    Reported-by: Waldemar Brodkorb
    Cc: Gabriel Laskar
    Signed-off-by: Mikko Rapeli
    Signed-off-by: David S. Miller

    Mikko Rapeli
     

19 Mar, 2016

1 commit


28 Feb, 2014

2 commits

  • These are private to userspace, and they're unstable
    anyway and can be shuffled at will (see 080e4130b1fb)
    so any userspace application relying on them is on crack.

    Test compiled with allyesconfig.

    mcgrof@drvbp1 /pub/mem/mcgrof/net-next (git::master)$ make allyesconfig
    mcgrof@drvbp1 /pub/mem/mcgrof/net-next (git::master)$ time make -j 20
    ...
    BUILD arch/x86/boot/bzImage
    Setup is 16992 bytes (padded to 17408 bytes).
    System is 56153 kB
    CRC 721d2751
    Kernel: arch/x86/boot/bzImage is ready (#1)
    real 19m35.744s
    user 280m37.984s
    sys 27m54.104s

    Cc: netdev@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: Ben Hutchings
    Cc: Florian Fainelli
    Cc: David Miller
    Signed-off-by: Luis R. Rodriguez
    Signed-off-by: David S. Miller

    Luis R. Rodriguez
     
  • We have documentation for these flags but they're scattered
    all over the place. #defines don't allow documentation to be
    written easily so to help to start bringing some documentation
    together use the enums kdoc practice but keep the defines to
    allow userspace to be able to #ifdef them.

    I've verified the same values are assigned before and after
    with a simple userspace test program [0] and checksumming the
    output.

    [0] http://drvbp1.linux-foundation.org/~mcgrof/kdoc/netdev_flags/

    mcgrof@gnat ~/tmp $ ./check-flags | sha1sum
    0ec5b6b1840aa3bb9ce464e61c564820871c92c3 -

    Cc: netdev@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: Ben Hutchings
    Cc: Florian Fainelli
    Cc: David Miller
    Signed-off-by: Luis R. Rodriguez
    Signed-off-by: David S. Miller

    Luis R. Rodriguez
     

08 Nov, 2013

1 commit

  • Add a operations structure that allows a network interface to export
    the fact that it supports package forwarding in hardware between
    physical interfaces and other mac layer devices assigned to it (such
    as macvlans). This operaions structure can be used by virtual mac
    devices to bypass software switching so that forwarding can be done
    in hardware more efficiently.

    Signed-off-by: John Fastabend
    Signed-off-by: Neil Horman
    CC: Andy Gospodarek
    CC: "David S. Miller"
    Signed-off-by: David S. Miller

    John Fastabend
     

13 Oct, 2012

1 commit