Skip to content

Commit

Permalink
net: sock: add sock_set_mark
Browse files Browse the repository at this point in the history
This patch adds a new socket helper function to set the mark value for a
kernel socket.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
  • Loading branch information
Alexander Aring authored and teigland committed Aug 6, 2020
1 parent 0ffddaf commit 84d1c61
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -2696,6 +2696,7 @@ void sock_no_linger(struct sock *sk);
void sock_set_keepalive(struct sock *sk);
void sock_set_priority(struct sock *sk, u32 priority);
void sock_set_rcvbuf(struct sock *sk, int val);
void sock_set_mark(struct sock *sk, u32 val);
void sock_set_reuseaddr(struct sock *sk);
void sock_set_reuseport(struct sock *sk);
void sock_set_sndtimeo(struct sock *sk, s64 secs);
Expand Down
8 changes: 8 additions & 0 deletions net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,14 @@ void sock_set_rcvbuf(struct sock *sk, int val)
}
EXPORT_SYMBOL(sock_set_rcvbuf);

void sock_set_mark(struct sock *sk, u32 val)
{
lock_sock(sk);
sk->sk_mark = val;
release_sock(sk);
}
EXPORT_SYMBOL(sock_set_mark);

/*
* This is meant for all protocols to use and covers goings on
* at the socket level. Everything here is generic.
Expand Down

0 comments on commit 84d1c61

Please sign in to comment.