[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200626172650.115224-2-aahringo@redhat.com>
Date: Fri, 26 Jun 2020 13:26:48 -0400
From: Alexander Aring <aahringo@...hat.com>
To: davem@...emloft.net
Cc: kuba@...nel.org, teigland@...hat.com, ccaulfie@...hat.com,
cluster-devel@...hat.com, netdev@...r.kernel.org,
Alexander Aring <aahringo@...hat.com>
Subject: [PATCHv2 dlm-next 1/3] 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 <aahringo@...hat.com>
---
include/net/sock.h | 1 +
net/core/sock.c | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/include/net/sock.h b/include/net/sock.h
index c53cc42b5ab92..591dd3f12dbb1 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -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);
diff --git a/net/core/sock.c b/net/core/sock.c
index 6c4acf1f0220b..ea6e8348b3dc8 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -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.
--
2.26.2
Powered by blists - more mailing lists