summaryrefslogtreecommitdiffstats
path: root/net/packet
diff options
context:
space:
mode:
authorEdward Jee <edjee@google.com>2015-10-08 14:56:49 -0700
committerDavid S. Miller <davem@davemloft.net>2015-10-12 19:25:22 -0700
commitc7d39e32632e5db9dc4da51198b76d8c315946ff (patch)
tree924e6fc7379bf29d87f07fe4c1b203c9ceab0043 /net/packet
parentf28ea365cdefc3b4fd0373e70b0106a0cd9b4c23 (diff)
downloadop-kernel-dev-c7d39e32632e5db9dc4da51198b76d8c315946ff.zip
op-kernel-dev-c7d39e32632e5db9dc4da51198b76d8c315946ff.tar.gz
packet: support per-packet fwmark for af_packet sendmsg
Signed-off-by: Edward Hyunkoo Jee <edjee@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet')
-rw-r--r--net/packet/af_packet.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 104910f..20c44e2 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2630,6 +2630,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
__be16 proto;
unsigned char *addr;
int err, reserve = 0;
+ struct sockcm_cookie sockc;
struct virtio_net_hdr vnet_hdr = { 0 };
int offset = 0;
int vnet_hdr_len;
@@ -2665,6 +2666,13 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
if (unlikely(!(dev->flags & IFF_UP)))
goto out_unlock;
+ sockc.mark = sk->sk_mark;
+ if (msg->msg_controllen) {
+ err = sock_cmsg_send(sk, msg, &sockc);
+ if (unlikely(err))
+ goto out_unlock;
+ }
+
if (sock->type == SOCK_RAW)
reserve = dev->hard_header_len;
if (po->has_vnet_hdr) {
@@ -2774,7 +2782,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
skb->protocol = proto;
skb->dev = dev;
skb->priority = sk->sk_priority;
- skb->mark = sk->sk_mark;
+ skb->mark = sockc.mark;
packet_pick_tx_queue(dev, skb);
OpenPOWER on IntegriCloud