summaryrefslogtreecommitdiffstats
path: root/net/core/sysctl_net_core.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-11-16 15:59:19 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-16 15:59:19 -0500
commit65622ed40eef5ce2732365077b22416593fec4c8 (patch)
tree3feae5512b57c55e708107e6c191fd5d611d17f9 /net/core/sysctl_net_core.c
parentca245024349c0d44434a6381583b99f0eb559c7c (diff)
parent6bf79cdddd50e90cbba7471623c129dadf9c873b (diff)
Merge branch 'rss_key_fill'
Eric Dumazet says: ==================== net: provide common RSS key infrastructure RSS (Receive Side Scaling) uses a 40 bytes key to provide hash for incoming packets to select appropriate incoming queue on NIC. Hash algo (Toeplitz) is also well known and documented by Microsoft (search for "Verifying the RSS Hash Calculation") Problem is that some drivers use a well known key. It makes very easy for attackers to target one particular RX queue, knowing that number of RX queues is a power of two, or at least some small number. Other drivers use a random value per port, making difficult tuning on bonding setups. Lets add a common infrastructure, so that host gets an unique RSS key, and drivers do not have to worry about this. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/sysctl_net_core.c')
-rw-r--r--net/core/sysctl_net_core.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index f93f092fe22..31baba2a71c 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -217,6 +217,18 @@ static int set_default_qdisc(struct ctl_table *table, int write,
}
#endif
+static int proc_do_rss_key(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+ struct ctl_table fake_table;
+ char buf[NETDEV_RSS_KEY_LEN * 3];
+
+ snprintf(buf, sizeof(buf), "%*phC", NETDEV_RSS_KEY_LEN, netdev_rss_key);
+ fake_table.data = buf;
+ fake_table.maxlen = sizeof(buf);
+ return proc_dostring(&fake_table, write, buffer, lenp, ppos);
+}
+
static struct ctl_table net_core_table[] = {
#ifdef CONFIG_NET
{
@@ -265,6 +277,13 @@ static struct ctl_table net_core_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec
},
+ {
+ .procname = "netdev_rss_key",
+ .data = &netdev_rss_key,
+ .maxlen = sizeof(int),
+ .mode = 0444,
+ .proc_handler = proc_do_rss_key,
+ },
#ifdef CONFIG_BPF_JIT
{
.procname = "bpf_jit_enable",