dect
/
libnl
Archived
13
0
Fork 0
Commit Graph

239 Commits

Author SHA1 Message Date
Thomas GraF 59880cb01e pktloc: support to specify a shift operator for packet locations
no users yet though.
2010-11-04 20:01:36 +01:00
Thomas GraF d283c8e889 Correctly state the process of sending a netlink message. A message
passes through nl_send_iovec() before hitting nl_sendmsg()
2010-11-04 19:35:57 +01:00
Thomas GraF 738ee7fea1 nl-qdisc-delete: Do not attempt to delete default qdiscs 2010-11-03 21:41:24 +01:00
Thomas Graf d95a4193f3 ematch/meta: id definitions 2010-11-03 01:09:28 +01:00
Thomas Graf df36c25bbf nl-classid-lookup: Added --raw option to print classid without pretty printing it 2010-11-01 15:20:43 +01:00
Thomas Graf 54e2539ce1 nl-qdisc-list: --recursive - print tc objects recursively 2010-11-01 13:41:57 +01:00
Thomas Graf 4e48d90e71 Correctly parse and generate classids
Make sure to parse strings starting with a hex represention letter
but not representing a valid number as tc names.

Fix typo while generating classid.
2010-11-01 13:17:19 +01:00
Thomas Graf 4267d8f336 classid auto generation if provided tc name does not exist
Manually editing etc/libnl/classid before adding tc objects is a pain.
This patch adds code to attempt auto generating a unique tc id which
will then be assigned to the provided name and added to the classid
file.

This will make the following commands work with prior definitions of
the names "top" and "test"
	sudo sbin/nl-qdisc-add --dev eth0 --parent root --id top htb
	sudo sbin/nl-class-add --dev eth0 --parent top --id test htb --rate 100mbit

It will generate the following ids automatically:
4001:			top
4001:1			test
2010-11-01 08:17:40 +01:00
Thomas Graf 7903d6ab4b Support for meta match
Syntax:
	meta(pktlen > 768)
2010-10-31 23:13:01 +01:00
Thomas Graf c7a673787b text ematch support 2010-10-29 21:10:02 +02:00
Thomas Graf 93f992eac5 attr: Add padding if nested data does not end at an alignment boundry
This could happen if a user put an unaligned amount of data inside
an attribute with nlmsg_append().
2010-10-29 18:40:48 +02:00
Thomas Graf cc22992d0c Improved debugging messages while constructing messages/attributes 2010-10-29 18:34:27 +02:00
Thomas Graf f703192a4f routing rules: adapt to unified routing rules
- Use FRA_ definitions
- Removed obsoleted fields
- Added fwmask and goto support
2010-10-29 12:48:46 +02:00
Thomas Graf 1eccb7b99c Revert "routing rules: mark support"
This reverts commit ee88c71d16.
2010-10-29 11:52:22 +02:00
Thomas Graf 858527622a Revert "Include RTA_MARK in routing rule messages"
This reverts commit 6862c6592a.
2010-10-29 11:52:08 +02:00
Thomas Graf 48cdb1fe66 Support RT_TABLE_COMPAT 2010-10-29 02:06:14 +02:00
Thomas Graf 2e6d49784b Support neighbour flag NTF_USE 2010-10-29 02:00:53 +02:00
Thomas Graf 873a64e2c1 Support for 64bit link counters IFLA_STATS64 2010-10-29 01:58:27 +02:00
Thomas Graf 6d434415ad Updated arp and ethernet codes 2010-10-29 01:48:13 +02:00
Thomas Graf 6862c6592a Include RTA_MARK in routing rule messages 2010-10-29 01:38:10 +02:00
Thomas Graf ee88c71d16 routing rules: mark support
Obsolete RTA_PROTOINFO code and parse RTA_MARK

rtnl_rule_set_mark(rule, mark)
rtnl_rule_get_mark(rule)

now access the mark as in firewall mark
2010-10-29 01:34:15 +02:00
Patrick McHardy 897828de32 src/nf-queue: revert nonsensical change
The only part of commit d378220c (src/nf-queue.c: cleanup and improve
performance of test program for NF_QUEUE) that actually makes sense is
the increase in receive buffer size. Issuing verdicts for IDs not delivered
to userspace is a wasted effort since the kernel drops packets itself when
netlink message delivery fails. This would actually have been noticed
by a return value of -ENOENT if the result of nfnl_queue_msg_send_verdict()
would have been checked.

Signed-off-by: Patrick McHardy <kaber@trash.net>
2010-10-29 01:00:25 +02:00
Thomas Graf 691905bc56 cgroup classifier improvements
- enabled again
 - ematch support
 - cli tools module

Example:
	nl-qdisc-add --dev eth0 --parent root --id 1: htb
	nl-cls-add --dev eth0 --parent 1: --id dead: cgroup
	nl-class-add --dev eth0 --parent 1: --id 1:<CGROUP> htb --rate 77mbit
2010-10-29 00:51:11 +02:00
Thomas Graf 2f867686ac basic: Only add ematches to message if available 2010-10-29 00:45:45 +02:00
Thomas Graf d7a561a137 Tons of ematch work
- Fixes a bunch of bugs related to ematches
 - Adds support for the nbyte ematch
 - Adds a bison/flex parser for ematch expressions, expressions
   may look like this:
      ip.length > 256 && pattern(ip6.src = 3ffe::/16)
   documenation on syntax follows
 - adds ematch support to the basic classifier (--ematch EXPR)
2010-10-29 00:20:42 +02:00
Thomas Graf e1eacd6b16 Fix use of uninitialized data at the end of netlink message
The netlink message buffer is preallocated to a page and later
expanded as needed. Everything was properly paded and zeroed
out except for the unused part at the end. Use calloc() to
allocate the buffer.
2010-10-29 00:17:07 +02:00
Thomas Graf d0e564548f Avoid memcpy()/memset() when reserving space for nested attributes 2010-10-29 00:16:40 +02:00
Thomas Graf 0fe5b29423 Extended pktloc to support nbyte locations for ipv6, etc.
The alignment column/field now also takes a number, specifying
the length in bytes of the field described by the location
2010-10-29 00:14:34 +02:00
Thomas Graf 65e386c8ba Packet location updates
This patch includes various bugfixes in the packet location parser.
Namely it removes two memory leaks if parsing fails. The parser is
correctly quit if an allocation error occurs and it is no longer
possible to add duplicates.

It removes the possibility to differ between net and host byteorder.
This is better done in the actual classifiers as it makes more sense
to specify this together with the value to compare against.

The patch also extends the API to add new packet locations via
rtnl_pktloc_add().

It introduces reference counting, therefore you now have to give
back packet locations with rtnl_pktloc_put() after looking them up
with rtnl_pktloc_lookup(). But you are allowed to keep using them
if the packet location file has been reread.

The packet location file now also understands "eth", "ip", and
"tcp" for "link", "net", and "transport".

A --list option has been added to nl-pktloc-lookup to list all
packet location definitions

A --u32=VALUE option has been added to let nl-pktloc-lookup print
the definition in iproute2's u32 selector style.

A manual page has been written for nl-pktloc-lookup.

Finally, nl-pktloc-lookup has been made installable.
2010-10-27 01:21:50 +02:00
Thomas Graf b57a697ef1 nl-cls-* tools
cli based tools to add/update/list/delete classifiers
2010-10-26 22:30:02 +02:00
Thomas Graf 4c6d1c5dfb Unified TC attributes interface
So far all common tc atttributes were accessed via specific functions, i.e.
rtnl_class_set_parent(), rtnl_qdisc_set_parent(), rtnl_cls_set_parent()
which implied a lot of code duplication. Since all tc objects are derived
from struct rtnl_tc and these common attributes are already stored in there
this patch removes all type specific functions and makes rtnl_tc_* attribute
functions public.

        rtnl_qdisc_set_parent(qdisc, 10);

becomes:

        rtnl_tc_set_parent((struct rtnl_tc *) qdisc, 10);

This patch also adds the following new attributes to tc objects therefore
removing them as tc specific attributes:
 - mtu
 - mpu
 - overhead

This allows for the rate table calculations to be unified as well taking into
account the new kernel behavior to take care of overhead automatically.
2010-10-26 12:54:33 +02:00
Thomas Graf b9d965b01b Update include/linux header copies
Adapts ratespec code taking into account that the kernel now takes
care of overhead calculations.
2010-10-21 19:47:14 +02:00
Thomas Graf 3a96527f24 nl-qdisc-add(8), nl-qdisc-delete(8), nl-qdisc-list(8) 2010-10-21 16:14:15 +02:00
Thomas Graf 2a9c3ef70e nl-class-list tool
Same syntax as nl-qdisc-list
2010-10-20 17:40:44 +02:00
Thomas Graf 8699ba85cc nl-class-delete tool
Tool based on nl-qdisc-delete to delete traffic classes.
2010-10-20 17:15:58 +02:00
Thomas Graf cefe7db730 Make nl-qdisc-delete installable
Fixes nl_cli_confirm() and adds a check enforcing --yes before deleting
all qdiscs on all devices.
2010-10-20 16:20:37 +02:00
Thomas Graf 420438c71f Remove NL_DUMP_ENV code
Dumping objects as environment variables has never been implemented
completely and only increases the size of the library for no real
purpose. Integration into scripts is better achieved by implementing
a python module anyway.
2010-10-20 15:32:45 +02:00
Thomas Graf a670ee5d72 make nl-qdisc-list installable
Also improves usability of nl-qdisc-list
2010-10-20 15:26:06 +02:00
Thomas Graf 27883b0f9b nl-class-add tool
Adds a cli based tool to add/update traffic classes. This tool requires
each class to be supported via the respetive qdisc module in
pkglibdir/cli/qdisc/$name.so.

Syntax:
nl-class-add --dev eth2 --parent 1: --id 1:1 htb --rate 100mbit
nl-class-add --update --dev eth2 --id 1:1 htb --rate 200mbit
2010-10-20 14:57:39 +02:00
Thomas Graf 18848090f9 pfifo/bfifo qdisc support for cli libs 2010-10-19 16:51:55 +02:00
Thomas Graf 23c6191726 remove obsolete nl-qdisc-add code 2010-10-19 16:35:26 +02:00
Thomas Graf 757592ec1b classid database
A database to resolve qdisc/class names to classid values and vice versa.
The function rtnl_tc_handle2str() and rtnl_tc_str2handle() will resolve
names automatically.

A CLI based tool nl-classid-lookup is provided to integrate the database
into existing iproute2 scripts.
2010-10-19 16:31:23 +02:00
Thomas Graf fa89403149 HTB: Append TCA_OPTIONS even if no options are set
The kernel requires the TCA_OPTIONS{TCA_HTB_INIT} attribute to be
present even if the default values are to be used.
2010-10-19 13:10:26 +02:00
Thomas Graf c0cd587dfc nl-qdisc-add tool
Adds a cli based tool to add/update/replace qdiscs. This tool requires
each qdisc to be supported via a dynamic loadable module in
pkglibdir/cli/qdisc/$name.so.

So far HTB and blackhole have been implemented.

Syntax:
nl-qdisc-add --dev eth2 --parent root --id 1: htb --r2q=5
nl-qdisc-add --update-only --dev eth2 --id 1: htb --r2q=10
2010-10-19 13:06:42 +02:00
Thomas Graf 3229b32e39 - Prepare for 2.1.x tree
- Bump interface number, we will break API in the development tree
2010-10-14 13:56:46 +02:00
dima 2dbc1ca76c Generic Netlink multicast groups support
I have a patch against commit d378220c96
extending libnl with a facility to receive generic netlink messages sent
to multicast groups.

Essentially it add one new function genl_ctrl_resolve_grp which
prototype looks like this
int genl_ctrl_resolve_grp(struct nl_sock *sk, const char *family_name,
        const char *grp_name)
It resolves  the family name and the group name to group id. Then
the returned id can be used in nl_socket_add_membership to subscribe
to multicast messages.

Besides that it adds two more functions

uint32_t nl_socket_get_peer_groups(struct nl_sock *sk)
void nl_socket_set_peer_groups(struct nl_sock *sk, uint32_t groups)

allowing to modify the socket peer groups field. So it's possible to
multicast messages from the user space using the legacy interface.
Looks like there is no way (or I was not able to find one?) to modify
the netlink socket destination group from the user space, when the
group id is greater then 32.
2010-10-14 13:46:02 +02:00
Thomas Graf 513e45ccce Don't include pktloc_syntax.h in BUILT_SOURCES 2010-10-13 16:50:33 +02:00
David Lamparter 2b3fabab9e route_obj: don't add empty destination to nlmsg
don't try to give the kernel an empty RTA_DST attribute. this would
previously happening on trying to delete the default route as returned
from the kernel. the kernel doesn't add a RTA_DST atttribute, so libnl
does nl_addr_alloc(0) and inserts a zero-length RTA_DST attribute into
the deletion request, which the kernel then refuses with ERANGE.

Signed-off-by: David Lamparter <equinox@diac24.net>
2010-10-13 15:21:14 +02:00
Andreas Bießmann cb05bbb0e2 automake: add ${top_builddir}/include to AM_CFLAGS
This patch enables out-of-source builds like this
  $ cd builddir && src_dir/configure && make

 Before this patch there was an error about missing netlink/version.h which
 is built by automake in top_builddir rather than top_srcdir which is already
 in include search path.

Signed-off-by: Andreas Bießmann <biessmann@corscience.de>
2010-10-13 14:36:09 +02:00
Thomas Graf 706ac94ed5 Use CPPFLAGS 2010-10-13 14:30:50 +02:00