mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
dst: Metadata destinations
Introduces a new dst_metadata which enables to carry per packet metadata between forwarding and processing elements via the skb->dst pointer. The structure is set up to be a union. Thus, each separate type of metadata requires its own dst instance. If demand arises to carry multiple types of metadata concurrently, metadata dst entries can be made stackable. The metadata dst entry is refcnt'ed as expected for now but a non reference counted use is possible if the reference is forced before queueing the skb. In order to allow allocating dsts with variable length, the existing dst_alloc() is split into a dst_alloc() and dst_init() function. The existing dst_init() function to initialize the subsystem is being renamed to dst_subsys_init() to make it clear what is what. The check before ip_route_input() is changed to ignore metadata dsts and drop the dst inside the routing function thus allowing to interpret metadata in a later commit. Signed-off-by: Thomas Graf <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
773a69d64b
commit
f38a9eb1f7
6 changed files with 112 additions and 17 deletions
|
|
@ -146,6 +146,7 @@
|
|||
#include <net/xfrm.h>
|
||||
#include <linux/mroute.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <net/dst_metadata.h>
|
||||
|
||||
/*
|
||||
* Process Router Attention IP option (RFC 2113)
|
||||
|
|
@ -331,7 +332,7 @@ static int ip_rcv_finish(struct sock *sk, struct sk_buff *skb)
|
|||
* Initialise the virtual path cache for the packet. It describes
|
||||
* how the packet travels inside Linux networking.
|
||||
*/
|
||||
if (!skb_dst(skb)) {
|
||||
if (!skb_valid_dst(skb)) {
|
||||
int err = ip_route_input_noref(skb, iph->daddr, iph->saddr,
|
||||
iph->tos, skb->dev);
|
||||
if (unlikely(err)) {
|
||||
|
|
|
|||
|
|
@ -1690,6 +1690,8 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
|
|||
by fib_lookup.
|
||||
*/
|
||||
|
||||
skb_dst_drop(skb);
|
||||
|
||||
if (ipv4_is_multicast(saddr) || ipv4_is_lbcast(saddr))
|
||||
goto martian_source;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue