ip: support SO_MARK cmsg
Enable setting skb->mark for UDP and RAW sockets using cmsg. This is analogous to existing support for TOS, TTL, txtime, etc. Packet sockets already support this as of commitc7d39e3263
("packet: support per-packet fwmark for af_packet sendmsg"). Similar to other fields, implement by 1. initialize the sockcm_cookie.mark from socket option sk_mark 2. optionally overwrite this in ip_cmsg_send/ip6_datagram_send_ctl 3. initialize inet_cork.mark from sockcm_cookie.mark 4. initialize each (usually just one) skb->mark from inet_cork.mark Step 1 is handled in one location for most protocols by ipcm_init_sk as of commit351782067b
("ipv4: ipcm_cookie initializers"). Signed-off-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
823eb2a3c4
commit
c6af0c227a
@@ -1130,7 +1130,7 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
||||
|
||||
fl4 = &fl4_stack;
|
||||
|
||||
flowi4_init_output(fl4, ipc.oif, sk->sk_mark, tos,
|
||||
flowi4_init_output(fl4, ipc.oif, ipc.sockc.mark, tos,
|
||||
RT_SCOPE_UNIVERSE, sk->sk_protocol,
|
||||
flow_flags,
|
||||
faddr, saddr, dport, inet->inet_sport,
|
||||
|
Reference in New Issue
Block a user