mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
netem: set fwmark only on linux
This commit is contained in:
parent
e79f7376a7
commit
d0e52ad633
2 changed files with 14 additions and 3 deletions
|
@ -84,12 +84,14 @@ struct node {
|
|||
|
||||
struct node_direction in, out;
|
||||
|
||||
#ifdef WITH_NETEM
|
||||
#ifdef __linux__
|
||||
int fwmark; /**< Socket mark for netem, routing and filtering */
|
||||
|
||||
#ifdef WITH_NETEM
|
||||
struct rtnl_qdisc *tc_qdisc; /**< libnl3: Network emulator queuing discipline */
|
||||
struct rtnl_cls *tc_classifier; /**< libnl3: Firewall mark classifier */
|
||||
#endif /* WITH_NETEM */
|
||||
#endif /* __linux__ */
|
||||
|
||||
struct node_type *_vt; /**< Virtual functions (C++ OOP style) */
|
||||
void *_vd; /**< Virtual data (used by struct node::_vt functions) */
|
||||
|
|
13
lib/node.c
13
lib/node.c
|
@ -225,7 +225,9 @@ int node_init(struct node *n, struct node_type *vt)
|
|||
n->_name = NULL;
|
||||
n->_name_long = NULL;
|
||||
|
||||
#ifdef __linux__
|
||||
n->fwmark = -1;
|
||||
#endif /* __linux__ *
|
||||
|
||||
#ifdef WITH_NETEM
|
||||
n->tc_qdisc = NULL;
|
||||
|
@ -282,16 +284,23 @@ int node_parse(struct node *n, json_t *json, const char *name)
|
|||
|
||||
n->name = strdup(name);
|
||||
|
||||
ret = json_unpack_ex(json, &err, 0, "{ s: s, s?: { s?: o }, s?: { s?: o, s: i } }",
|
||||
ret = json_unpack_ex(json, &err, 0, "{ s: s, s?: { s?: o } }",
|
||||
"type", &type,
|
||||
"in",
|
||||
"signals", &json_signals,
|
||||
"signals", &json_signals
|
||||
);
|
||||
if (ret)
|
||||
jerror(&err, "Failed to parse node %s", node_name(n));
|
||||
|
||||
#ifdef __linux__
|
||||
ret = json_unpack_ex(json, &err, 0, "{ s?: { s: o, s: i } }",
|
||||
"out",
|
||||
"netem", &json_netem,
|
||||
"fwmark", &n->fwmark
|
||||
);
|
||||
if (ret)
|
||||
jerror(&err, "Failed to parse node %s", node_name(n));
|
||||
#endif /* __linux__ */
|
||||
|
||||
nt = node_type_lookup(type);
|
||||
assert(nt == node_type(n));
|
||||
|
|
Loading…
Add table
Reference in a new issue