Message ID | 1387416579-3098-3-git-send-email-dborkman@redhat.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
From: Daniel Borkmann <dborkman@redhat.com> Date: Thu, 19 Dec 2013 02:29:39 +0100 > @@ -29,6 +29,9 @@ struct sockaddr_ll { > /* These ones are invisible by user level */ > #define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */ > #define PACKET_FASTROUTE 6 /* Fastrouted frame */ > +/* These ones are for nlmon devices */ > +#define PACKET_USER 0 /* To user space */ > +#define PACKET_KERNEL 1 /* To kernel space */ I know it is tempting to do so, but please do not reuse values like this. THanks. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 12/23/2013 12:56 AM, David Miller wrote: > From: Daniel Borkmann <dborkman@redhat.com> > Date: Thu, 19 Dec 2013 02:29:39 +0100 > >> @@ -29,6 +29,9 @@ struct sockaddr_ll { >> /* These ones are invisible by user level */ >> #define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */ >> #define PACKET_FASTROUTE 6 /* Fastrouted frame */ >> +/* These ones are for nlmon devices */ >> +#define PACKET_USER 0 /* To user space */ >> +#define PACKET_KERNEL 1 /* To kernel space */ > > I know it is tempting to do so, but please do not reuse values > like this. Hm, ok. As we only have 3 bits for all this, are you okay with doing the following ... #define PACKET_USER 6 /* To user space */ #define PACKET_KERNEL 7 /* To kernel space */ PACKET_FASTROUTE isn't used anywhere in the tree, only defined in this header file. Then, by doing this, we would still fit. > THanks. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/include/uapi/linux/if_packet.h b/include/uapi/linux/if_packet.h index e9d844c..a8d4ff1 100644 --- a/include/uapi/linux/if_packet.h +++ b/include/uapi/linux/if_packet.h @@ -29,6 +29,9 @@ struct sockaddr_ll { /* These ones are invisible by user level */ #define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */ #define PACKET_FASTROUTE 6 /* Fastrouted frame */ +/* These ones are for nlmon devices */ +#define PACKET_USER 0 /* To user space */ +#define PACKET_KERNEL 1 /* To kernel space */ /* Packet socket options */ diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 56e09d8..3f75f1c 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -204,6 +204,8 @@ static int __netlink_deliver_tap_skb(struct sk_buff *skb, if (nskb) { nskb->dev = dev; nskb->protocol = htons((u16) sk->sk_protocol); + nskb->pkt_type = netlink_is_kernel(sk) ? + PACKET_KERNEL : PACKET_USER; ret = dev_queue_xmit(nskb); if (unlikely(ret > 0))