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

some preparations for netem and irq affinity stuff

git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@60 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
Steffen Vogel 2014-06-05 09:35:39 +00:00
parent 6fc85c49ab
commit 7f4eb885ff
2 changed files with 21 additions and 2 deletions

View file

@ -48,6 +48,12 @@ struct node
/// Remote address of the socket
struct sockaddr_in remote;
/// Name of the local interface
const char *ifname;
/// Index of the local interface
int ifindex;
/// Socket Mark
int mark;
/// A short identifier of the node
const char *name;

View file

@ -19,6 +19,7 @@
#include "utils.h"
#include "msg.h"
#include "node.h"
#include "if.h"
int node_create(struct node *n, const char *name, enum node_type type,
struct sockaddr_in local, struct sockaddr_in remote)
@ -29,6 +30,10 @@ int node_create(struct node *n, const char *name, enum node_type type,
n->local = local;
n->remote = remote;
/* We use to local address to determine the outgoing interface */
//n->ifname = if_addrtoname((struct sockaddr*) &local);
//n->ifindex = if_nametoindex(n->ifname);
return 0;
}
@ -41,8 +46,16 @@ int node_connect(struct node *n)
/* Set socket options */
int prio = SOCKET_PRIO;
if (setsockopt(n->sd, SOL_SOCKET, SOCKET_PRIO, &prio, sizeof(prio)))
perror("Failed to set socket options");
if (setsockopt(n->sd, SOL_SOCKET, SO_PRIORITY, &prio, sizeof(prio)))
perror("Failed to set socket priority");
else
debug(4, "Set socket priority of node '%s' to %u", n->name, prio);
/* Set mark for outgoing packets */
if (setsockopt(n->sd, SOL_SOCKET, SO_MARK, &n->mark, sizeof(n->mark)))
perror("Failed to set mark for outgoing packets");
else
debug(4, "Set mark of outgoing packets of node '%s' to %u", n->name, n->mark);
/* Bind socket for receiving */
if (bind(n->sd, (struct sockaddr *) &n->local, sizeof(struct sockaddr_in)))