Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
radkesvat committed Aug 17, 2024
1 parent cecfe12 commit db17c9a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions tunnels/layer3/ip/manipulator/ip_manipulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ tunnel_t *newLayer3IpManipulator(node_instance_context_t *instance_info)
}

state->protocol_action = parseDynamicNumericValueFromJsonObject(
settings, "bit-reset", 36, "icmp", "igmp", "tcp", "egp", "udp", "rdp", "dccp", "ipv6", "ipv6-frag", "rsvp",
settings, "protocol", 36, "icmp", "igmp", "tcp", "egp", "udp", "rdp", "dccp", "ipv6", "ipv6-frag", "rsvp",
"gre", "esp", "ah", "icmpv6", "nonext", "destopts", "eigrp", "ospf", "ipip", "pim", "pcap", "vrrp", "l2tp",
"isis", "sctp", "fc", "udplite", "mpls", "manet", "hip", "shim6", "wesp", "rohc", "test1", "test2", "reserved");

Expand All @@ -143,7 +143,7 @@ tunnel_t *newLayer3IpManipulator(node_instance_context_t *instance_info)

if (state->protocol_action.status > kDvsConstant)
{
state->protocol_action.value = map_array[state->protocol_action.status];
state->protocol_action.value = map_array[state->protocol_action.status - kDvsFirstOption];
}

tunnel_t *t = newTunnel();
Expand Down
14 changes: 7 additions & 7 deletions tunnels/layer3/receiver/receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

typedef struct layer3_receiver_state_s
{
char *tundevice_name;
tunnel_t *tun_device_tunnel;
char *device_name;
tunnel_t *device_tunnel;

} layer3_receiver_state_t;

Expand Down Expand Up @@ -99,19 +99,19 @@ tunnel_t *newLayer3Receiver(node_instance_context_t *instance_info)
return NULL;
}

if (! getStringFromJsonObject(&(state->tundevice_name), settings, "device"))
if (! getStringFromJsonObject(&(state->device_name), settings, "device"))
{
LOGF("JSON Error: Layer3Receiver->settings->device (string field) : The string was empty or invalid");
globalFree(state);
return NULL;
}

hash_t hash_tdev_name = CALC_HASH_BYTES(state->tundevice_name, strlen(state->tundevice_name));
hash_t hash_tdev_name = CALC_HASH_BYTES(state->device_name, strlen(state->device_name));
node_t *tundevice_node = getNode(instance_info->node_manager_config, hash_tdev_name);

if (tundevice_node == NULL)
{
LOGF("Layer3Receiver: could not find tun device node \"%s\"", state->tundevice_name);
LOGF("Layer3Receiver: could not find tun device node \"%s\"", state->device_name);
globalFree(state);
return NULL;
}
Expand All @@ -129,12 +129,12 @@ tunnel_t *newLayer3Receiver(node_instance_context_t *instance_info)

if (tundevice_node->instance->up != NULL)
{
LOGF("Layer3Receiver: tun device \"%s\" cannot be used by 2 receivers", state->tundevice_name);
LOGF("Layer3Receiver: tun device \"%s\" cannot be used by 2 receivers", state->device_name);
globalFree(state);
return NULL;
}

state->tun_device_tunnel = tundevice_node->instance;
state->device_tunnel = tundevice_node->instance;

tunnel_t *t = newTunnel();

Expand Down
16 changes: 8 additions & 8 deletions tunnels/layer3/sender/sender.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

typedef struct layer3_senderstate_s
{
char *tundevice_name;
tunnel_t *tun_device_tunnel;
char *device_name;
tunnel_t *device_tunnel;

} layer3_senderstate_t;

Expand Down Expand Up @@ -106,7 +106,7 @@ static void upStream(tunnel_t *self, context_t *c)
exit(1);
}

state->tun_device_tunnel->upStream(state->tun_device_tunnel, c);
state->device_tunnel->upStream(state->device_tunnel, c);
}

static void downStream(tunnel_t *self, context_t *c)
Expand Down Expand Up @@ -154,7 +154,7 @@ static void onTimer(htimer_t *timer)
int ip_header_len = packet->ip4_header.ihl * 4;
packet->ip4_header.check = standardCheckSum((void *) packet, ip_header_len);

state->tun_device_tunnel->upStream(state->tun_device_tunnel, c);
state->device_tunnel->upStream(state->device_tunnel, c);
}

tunnel_t *newLayer3Sender(node_instance_context_t *instance_info)
Expand All @@ -170,19 +170,19 @@ tunnel_t *newLayer3Sender(node_instance_context_t *instance_info)
return NULL;
}

if (! getStringFromJsonObject(&(state->tundevice_name), settings, "device"))
if (! getStringFromJsonObject(&(state->device_name), settings, "device"))
{
LOGF("JSON Error: Layer3Sender->settings->device (string field) : The string was empty or invalid");
globalFree(state);
return NULL;
}

hash_t hash_tdev_name = CALC_HASH_BYTES(state->tundevice_name, strlen(state->tundevice_name));
hash_t hash_tdev_name = CALC_HASH_BYTES(state->device_name, strlen(state->device_name));
node_t *tundevice_node = getNode(instance_info->node_manager_config, hash_tdev_name);

if (tundevice_node == NULL)
{
LOGF("Layer3Sender: could not find tun device node \"%s\"", state->tundevice_name);
LOGF("Layer3Sender: could not find tun device node \"%s\"", state->device_name);
globalFree(state);
return NULL;
}
Expand All @@ -198,7 +198,7 @@ tunnel_t *newLayer3Sender(node_instance_context_t *instance_info)
return NULL;
}

state->tun_device_tunnel = tundevice_node->instance;
state->device_tunnel = tundevice_node->instance;

tunnel_t *t = newTunnel();

Expand Down
7 changes: 4 additions & 3 deletions ww/managers/signal_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ static void multiplexedSignalHandler(int signum)

static void multiplexedSignalHandlerNoArg(void)
{
static const char kMessage[] = "SignalManager: Executing exit callabck\n";
int unused = write(STDOUT_FILENO, kMessage, sizeof(kMessage) - 1);
(void) unused;
// static const char kMessage[] = "SignalManager: Executing exit callabck\n";
// int unused = write(STDOUT_FILENO, kMessage, sizeof(kMessage) - 1);
// (void) unused;

for (unsigned int i = 0; i < state->handlers_len; i++)
{
Expand Down Expand Up @@ -179,6 +179,7 @@ void startSignalManager(void)
exit(1);
}
}

#endif

atexit(multiplexedSignalHandlerNoArg);
Expand Down

0 comments on commit db17c9a

Please sign in to comment.