Commit 746e6ad23cd6fec2edce056e014a0eabeffa838c

Authored by John Dykstra
Committed by David S. Miller
1 parent 8981f01001

[PATCH] net core: Some interface flags not returned by SIOCGIFFLAGS

Commit b00055aacdb172c05067612278ba27265fcd05ce " [NET] core: add
RFC2863 operstate" defined new interface flag values.  Its
documentation specified that these flags could be accessed from user
space via SIOCGIFFLAGS.  However, this does not work because the new
flags do not fit in that ioctl's argument width.

Change the documentation to match the code's behavior.  Also change
the source to explicitly show the truncation.  This _should_ have no
effect on executable code, and did not with gcc 4.2.4 generating x86
code.

A new ioctl could be defined to return all interface flags to user
space.  However, since this has been broken for three years with no
one complaining, there doesn't seem much need.  They are still
accessible via netlink.

Reported-by:  "Fredrik Arnerup" <fredrik.arnerup@edgeware.tv>
Signed-off-by: John Dykstra <john.dykstra1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 1 additions and 4 deletions Side-by-side Diff

Documentation/networking/operstates.txt
... ... @@ -38,9 +38,6 @@
38 38 ifinfomsg::if_flags & IFF_DORMANT:
39 39 Driver has signaled netif_dormant_on()
40 40  
41   -These interface flags can also be queried without netlink using the
42   -SIOCGIFFLAGS ioctl.
43   -
44 41 TLV IFLA_OPERSTATE
45 42  
46 43 contains RFC2863 state of the interface in numeric representation:
... ... @@ -4209,7 +4209,7 @@
4209 4209  
4210 4210 switch (cmd) {
4211 4211 case SIOCGIFFLAGS: /* Get interface flags */
4212   - ifr->ifr_flags = dev_get_flags(dev);
  4212 + ifr->ifr_flags = (short) dev_get_flags(dev);
4213 4213 return 0;
4214 4214  
4215 4215 case SIOCGIFMETRIC: /* Get the metric on the interface