1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

move socket option to socket.c instead of if.c (socket descriptor isn't initialized yet)

This commit is contained in:
Steffen Vogel 2015-05-07 12:58:35 +02:00
parent 0f8c69635f
commit 6915ea0c0d
2 changed files with 6 additions and 6 deletions

View file

@ -64,12 +64,6 @@ int if_start(struct interface *i, int affinity)
if (s->netem) {
s->mark = 1 + mark++;
/* Set fwmark for outgoing packets */
if (setsockopt(s->sd, SOL_SOCKET, SO_MARK, &s->mark, sizeof(s->mark)))
serror("Failed to set fwmark for outgoing packets");
else
debug(4, "Set fwmark for socket (sd=%u) to %u", s->sd, s->mark);
tc_mark(i, TC_HDL(4000, s->mark), s->mark);
tc_netem(i, TC_HDL(4000, s->mark), s->netem);
}

View file

@ -121,6 +121,12 @@ int socket_open(struct node *n)
if (ret < 0)
serror("Failed to connect socket");
}
/* Set fwmark for outgoing packets */
if (setsockopt(s->sd, SOL_SOCKET, SO_MARK, &s->mark, sizeof(s->mark)))
serror("Failed to set fwmark for outgoing packets");
else
debug(4, "Set fwmark for socket (sd=%u) to %u", s->sd, s->mark);
/* Set socket priority, QoS or TOS IP options */
int prio;