From db17c9a79eea29a3d64a968e553929e4ec92c29a Mon Sep 17 00:00:00 2001 From: Radkesvat <134321679+radkesvat@users.noreply.github.com> Date: Sat, 17 Aug 2024 16:43:23 +0000 Subject: [PATCH] reformat --- tunnels/layer3/ip/manipulator/ip_manipulator.c | 4 ++-- tunnels/layer3/receiver/receiver.c | 14 +++++++------- tunnels/layer3/sender/sender.c | 16 ++++++++-------- ww/managers/signal_manager.c | 7 ++++--- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/tunnels/layer3/ip/manipulator/ip_manipulator.c b/tunnels/layer3/ip/manipulator/ip_manipulator.c index 576e4b4..fa4a5f7 100644 --- a/tunnels/layer3/ip/manipulator/ip_manipulator.c +++ b/tunnels/layer3/ip/manipulator/ip_manipulator.c @@ -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"); @@ -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(); diff --git a/tunnels/layer3/receiver/receiver.c b/tunnels/layer3/receiver/receiver.c index 489901c..960d1dc 100644 --- a/tunnels/layer3/receiver/receiver.c +++ b/tunnels/layer3/receiver/receiver.c @@ -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; @@ -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; } @@ -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(); diff --git a/tunnels/layer3/sender/sender.c b/tunnels/layer3/sender/sender.c index c7c6797..10c4aa9 100644 --- a/tunnels/layer3/sender/sender.c +++ b/tunnels/layer3/sender/sender.c @@ -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; @@ -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) @@ -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) @@ -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; } @@ -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(); diff --git a/ww/managers/signal_manager.c b/ww/managers/signal_manager.c index bb4cd09..f9844fb 100644 --- a/ww/managers/signal_manager.c +++ b/ww/managers/signal_manager.c @@ -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++) { @@ -179,6 +179,7 @@ void startSignalManager(void) exit(1); } } + #endif atexit(multiplexedSignalHandlerNoArg);