Commit Graph

78 Commits

Author SHA1 Message Date
Stephen Hemminger
6cf8398f5f libnetlink: change rtnl_send() to take void *
Avoid having to cast buffer being sent.
2011-12-23 10:41:50 -08:00
Stephen Hemminger
2dd9f8e073 libnetlink: fix set never used warning 2011-06-20 14:34:46 -07:00
Ben Greear
3bc1c4f297 iproute2: Fix filtering related to flushing IP addresses.
The old 'ip addr flush' logic had several flaws:

* It reversed logic for primary v/s secondary flags
  (though, it sort of worked right anyway)

* The code tried to remove secondaries and then primaries,
  but in practice, it always removed one primary per loop,
  which not at all efficient.

* The filter logic in the core would run only the first
  filter in most cases.

* If you used '-s -s', the ifa_flags member would be
  modified, which could make future filters fail
  to function fine.

This patch attempts to fix all of these issues.

Tested-by: Brian Haley <brian.haley@hp.com>
Signed-off-by: Ben Greear <greearb@candelatech.com>
2010-08-23 08:10:32 -07:00
Williams, Mitch A
6e46ec813b libnetlink: Modify the parser to track first duplicated attributes
Modify the parser to keep track of the first of any duplicated attributes,
instead of the last. This is required for VF configuration reporting, where
multiple attributes of the same type are added sequentially.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2010-03-03 16:33:28 -08:00
Simon Horman
b49240ec7e flush secondary addresses before primary ones
Unless promote_secondaries has been active deleting the primary address of
an interface will automatically delete all the secondary addresses.

In the case where ip flush requests the primary then secondary addresses to
be removed - which is the order the addresses are returned by the kernel -
this will cause an error as by the time the request to remove a secondary
address is made it will be missing as it will have been deleted in the
course of deleting the primary address.

This approach to solving this problem orders requests for the
deletion of secondary addresses before primary ones providing
rtnl_dump_filter_l(), a version of rtnl_dump_filter() that
iterates over a list of filters. And by providing two specialised
filters print_addrinfo_secondary() and print_addrinfo_primary().

rtnl_dump_filter_l() first iterates over all addresses using
print_addrinfo_secondary(), which appends secondary addresses to the
request buffer.  Then again using print_addrinfo_primary() which appends
primary addresses.

This approach should work regardless of it promote_secondaries is
active or not. And regardless of if any primary of secondary addresses
are present or not.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-12-26 10:11:02 -08:00
Patrick McHardy
7f03191fda iproute uses too small of a receive buffer
It uses 1MB as receive buf limit by default (without
increasing /proc/sys/net/core/rmem_max it will be limited by less
however) and allows to specify the size manually using "-rcvbuf X"
(-r is already used, so you need to specify at least -rc).

Additionally rtnl_listen() continues on ENOBUFS after printing the
error message.
2009-11-10 09:14:33 -08:00
Sven Anders
24f3818244 Fix flushing code - rtnl_send_check
I experienced an error, if I try to perform a

  ip route flush proto 4

with many routes in a complex environment, it
gave me the following error:

  Failed to send flush request: Success
  Flush terminated
2009-11-10 09:07:26 -08:00
Stephen Hemminger
2d8240f8d9 Fix flushing of large number of entries
Checking for errors would cause some responses to be lost.
2009-07-13 10:15:23 -07:00
Stephen Hemminger
f31a37f79d fix problem caused by rtnl_send checks
Some usages of rtnl_send could cause errors (ie flush requests)
others do a listen afterwards.

Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
2008-01-31 21:38:58 -08:00
Stephen Hemminger
54bb35c69c poll for errors after rtnl_send
This fixes the problem where a bulk operation (like ip flush)
is performed as non-root user.  The kernel will only send a response
if there is an error, so check for it.
2008-01-26 11:09:42 -08:00
Stephen Hemminger
aa8032e628 libnetlink: don't spin forever on receive error
If there is a problem talking to kernel, don't retry except in the
special case of signal or -EAGAIN

Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
2008-01-25 15:39:09 -08:00
Stephen Hemminger
037c635eee Fix off by one in nested attribute management.
Fixes segv in:
  tc qdisc show dev eth1
due to uninitialized attribute table.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
2007-12-10 11:34:40 -08:00
Patrick McHardy
2f90c9c0bb IPROUTE2: RTNETLINK nested attributes
This adds capability for iproute2 to send nested attributes to the
kernel, while maintaining backwards compatibility.

Signed-off-by: Patrick McHardy <kaber@trash.net>
2007-08-22 10:04:20 -07:00
Stephen Hemminger
b16621cafd incorrect initialization
Fix initialization in libnetlink.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
2007-05-10 19:33:21 -07:00
Stephen Hemminger
3bfa73ff99 rtnl fd check
Prevent accidental damage from rtnl library if fd is uninitialized.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
2006-09-26 10:41:57 -07:00
shemminger
4cca16f20e Fix endless loop in netlink error handling. 2006-03-10 23:31:46 +00:00
shemminger
fb2297599d When assigning an ip address to an ethernet adapter, the newest
(050929) version of 'ip addr' hangs while older versions worked.
The problem was traced to be a removed initialisation. The patch
below corrects this problem.
2005-10-04 23:15:32 +00:00
shemminger
8ed63ab1f1 Fix leaks and warnings reported by valgrind. 2005-09-21 19:33:17 +00:00
shemminger
f332d16924 Cleanup GCC4 warnings about signedness. 2005-07-05 22:37:15 +00:00
net[shemminger]!shemminger
3dabdbb3da Import patch netlink-align
(Logical change 1.179)
2005-03-30 18:18:12 +00:00
osdl.net!shemminger
175e2440df gcc 2.95 compile fix.
(Logical change 1.138)
2005-02-07 18:17:38 +00:00
6!tgraf
07f9436201 Use NLMSG_TAIL and add addraw_l
(Logical change 1.128)
2005-01-18 13:58:49 +00:00
osdl.net!shemminger
6dc9f01634 make all filtering handles take const args.
(Logical change 1.77)
2004-08-31 17:45:21 +00:00
osdl.net!shemminger
007d3a3e9f Bigger send/receive buf.
(Logical change 1.66)
2004-08-13 23:54:55 +00:00
net[shemminger]!shemminger
c7699875be Import patch ipxfrm-20040707_2.diff
(Logical change 1.53)
2004-07-07 17:05:56 +00:00
org[shemminger]!shemminger
10f57ef1ab Import patch iproute2-2.4.7-netlink.patch
(Logical change 1.9)
2004-06-07 22:04:04 +00:00
osdl.org!shemminger
aba5acdfdb (Logical change 1.3) 2004-04-15 20:56:59 +00:00
osdl.org!shemminger
86fdf0e47b Initial revision 2004-04-15 20:56:59 +00:00