summaryrefslogtreecommitdiffstats
path: root/src/socket.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-01-26 03:37:36 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-01-26 03:37:36 +0100
commit53d331406d6b1cbe934528f87023b87887993e0e (patch)
tree7d8406c0bfc3ec9521c49d60ad977765280d8ceb /src/socket.c
parentcc498848b36b347aa9b710ab55c1fcc8643a4633 (diff)
downloadfastd-53d331406d6b1cbe934528f87023b87887993e0e.tar
fastd-53d331406d6b1cbe934528f87023b87887993e0e.zip
Add support for setting packet marks
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/socket.c b/src/socket.c
index 06d270d..af99894 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -96,6 +96,15 @@ static int bind_socket(fastd_context_t *ctx, const fastd_bind_address_t *addr, b
}
#endif
+#ifdef USE_PACKET_MARK
+ if (ctx->conf->packet_mark) {
+ if (setsockopt(fd, SOL_SOCKET, SO_MARK, &ctx->conf->packet_mark, sizeof(ctx->conf->packet_mark))) {
+ pr_error_errno(ctx, "setsockopt: unable to set packet mark");
+ goto error;
+ }
+ }
+#endif
+
fastd_peer_address_t bind_address = addr->addr;
if (bind_address.sa.sa_family == AF_UNSPEC) {