Skip to content

Commit 84d1c61

Browse files
Alexander Aringteigland
authored andcommitted
net: sock: add sock_set_mark
This patch adds a new socket helper function to set the mark value for a kernel socket. Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent 0ffddaf commit 84d1c61

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/net/sock.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2696,6 +2696,7 @@ void sock_no_linger(struct sock *sk);
26962696
void sock_set_keepalive(struct sock *sk);
26972697
void sock_set_priority(struct sock *sk, u32 priority);
26982698
void sock_set_rcvbuf(struct sock *sk, int val);
2699+
void sock_set_mark(struct sock *sk, u32 val);
26992700
void sock_set_reuseaddr(struct sock *sk);
27002701
void sock_set_reuseport(struct sock *sk);
27012702
void sock_set_sndtimeo(struct sock *sk, s64 secs);

net/core/sock.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,14 @@ void sock_set_rcvbuf(struct sock *sk, int val)
828828
}
829829
EXPORT_SYMBOL(sock_set_rcvbuf);
830830

831+
void sock_set_mark(struct sock *sk, u32 val)
832+
{
833+
lock_sock(sk);
834+
sk->sk_mark = val;
835+
release_sock(sk);
836+
}
837+
EXPORT_SYMBOL(sock_set_mark);
838+
831839
/*
832840
* This is meant for all protocols to use and covers goings on
833841
* at the socket level. Everything here is generic.

0 commit comments

Comments
 (0)