| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
rtnl_act_append() either takes ownership of the argument, or does
nothing (on error). This pattern is hard to get right. In the past,
there were various bugs at this place.
Add two wrappers _rtnl_act_append_get() and _rtnl_act_append_take()
which consistently don't take ownership of the pointer or take it.
Also, in functions like rtnl_flower_append_action() only set the mask
after successfully modifying the data.
|
|
|
|
|
|
| |
Using rtnl_act_append() correctly is hard.
Fixes: ef46de143206 ('route/cls: add flower classifier')
|
| |
|
| |
|
|
|
|
|
| |
Move all the declarations from "netlink-private/types.h" to places
closer to where they are used.
|
|
|
|
|
| |
It's a private header only for lib/route (libnl-route-3). We already
have a similar header. Move the content to "lib/route/tc-api.h".
|
|
|
|
|
|
|
|
| |
This header is entirely private to lib/route (libnl-route-3).
Move the header there, it should not be used by anybody else.
Note that libnl-route-3 exports symbols from this private header. That
is ugly, make that clearer by adding comments.
|
|
|
|
|
| |
We should have things with "nl" prefix in our headers. Also, netlink-private/netlink.h
is not header-only, preferably header-only stuff is in netlink-private/utils.h
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following API has been added:
rtnl_flower_set_ipv4_src
rtnl_flower_get_ipv4_src
rtnl_flower_set_ipv4_dst
rtnl_flower_get_ipv4_dst
Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@westermo.com>
https://github.com/thom311/libnl/pull/309
|
|
|
|
|
|
|
|
| |
Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@westermo.com>
Fixes: ef46de143206 ('route/cls: add flower classifier')
https://github.com/thom311/libnl/pull/316
|
| |
|
|
|
|
|
|
| |
The problem here is not really NOMEM (because rtnl_tc_data_peek() wouldn't
allocate new memory. The problem is, that the cls instance has no such data
field. Return -NLE_INVAL instead.
|
|
|
|
|
|
| |
nl_object_clone() already does a shallow clone using memcpy(). So all
simple fields are already initialized. We only need the oo_clone() implementation
to get the deep-copy right.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We often require that a valid output pointer is passed to the
getters. But here, let's be forgiving. Being more forgiving
may be inconsistent, but on the safe side: the user is still
welcome to assume they must provide a valid output pointer.
Also, we always need to initialize the output mask, not only
with `f->cf_mask & FLOWER_ATTR_DST_MAC_MASK`. The reason is that
the caller cannot know whether the mask is present, so conditionally
initializing the output is error prone (it requires the caller
to NUL initialize first). Also, "f->cf_dst_mac_mask" really should
be zero initialized, if the mask indicates that it's unset. This
means, we can just always memcpy the mask.
|
| |
|
| |
|
|
This patch adds a subset of functions.
Implemented api:
rtnl_flower_set_proto;
rtnl_flower_get_proto;
rtnl_flower_set_vlan_id;
rtnl_flower_get_vlan_id;
rtnl_flower_set_vlan_prio;
rtnl_flower_get_vlan_prio;
rtnl_flower_set_vlan_ethtype;
rtnl_flower_set_dst_mac;
rtnl_flower_get_dst_mac;
rtnl_flower_set_src_mac;
rtnl_flower_get_src_mac;
rtnl_flower_set_ip_dscp;
rtnl_flower_get_ip_dscp;
rtnl_flower_set_flags;
rtnl_flower_append_action;
rtnl_flower_del_action;
rtnl_flower_get_action;
[thaller@redhat.com: squashed commit "route:cls:flower: use parentheses in
macro definitions"]
[thaller@redhat.com: squashed commit "cls:flower: add TCA_FLOWER_FLAGS
to flower_policy"]
[thaller@redhat.com: squashed commit "cls:flower: vlan priority is
uint8_t, not uint16_t"]
[thaller@redhat.com: squashed commit "route:cls:flower: substitute nl_data*
with uint8_t mac[ETH_ALEN]"]
[thaller@redhat.com: drop non-existing TCA_FLOWER_POLICE. That was
never merged to upstream kernel. While at it, use decimal numbers
for the bitshift.]
[thaller@redhat.com: fix build by including <linux/if_ether.h> in
"types.h".]
Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@westermo.se>
|