summaryrefslogtreecommitdiff
path: root/staging/layer3.c
diff options
context:
space:
mode:
authorPetr Machata <petrm@mellanox.com>2019-10-01 16:40:11 +0000
committerTobias Klauser <tklauser@distanz.ch>2019-10-04 10:23:46 +0200
commit5f67447541f2382dfbae354d38a21b0e1482028d (patch)
treeab5599c5380b78d098ba22183c8e3bd2c048120a /staging/layer3.c
parent0bdd9e1b61534f099ba2a13f8143632a47bf8c27 (diff)
mausezahn: Support -R to set packet priority
Add a command line option -R to specify SO_PRIORITY socket option. This then sets priority of the generated SKBs, which is handy for testing Qdiscs and other priority-dependent functionality. Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'staging/layer3.c')
-rw-r--r--staging/layer3.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/staging/layer3.c b/staging/layer3.c
index 0b17db1..7dabc26 100644
--- a/staging/layer3.c
+++ b/staging/layer3.c
@@ -133,6 +133,15 @@ libnet_t* get_link_context(void)
fprintf(stderr, "%s", errbuf);
exit(EXIT_FAILURE);
}
+
+ if (tx.prio != 0 &&
+ setsockopt (libnet_getfd (l), SOL_SOCKET, SO_PRIORITY, &tx.prio,
+ sizeof tx.prio) < 0)
+ {
+ perror("setsockopt SO_PRIORITY");
+ exit(EXIT_FAILURE);
+ }
+
return l;
}