Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
radkesvat committed Aug 9, 2024
1 parent 60a49fe commit 84878da
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tunnels/layer3/ip_overrider/ip_overrider.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ static void upStreamSrcMode(tunnel_t *self, context_t *c)

packet_mask *packet = (packet_mask *) (rawBufMut(c->payload));

if (packet->ip4_header.version == 4)
if (state->support4 && packet->ip4_header.version == 4)
{
// alignment assumed to be correct
packet->ip4_header.saddr = state->ov_4;
}
else if (packet->ip6_header.version == 6)
else if (state->support6 && packet->ip6_header.version == 6)
{

// alignment assumed to be correct
Expand Down
6 changes: 4 additions & 2 deletions tunnels/layer3/receiver/receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ enum mode_dynamic_value_status
kDvsSourceMode = kDvsFirstOption,
kDvsDestMode
};
struct ip6_hdr;

static void upStream(tunnel_t *self, context_t *c)
{
// layer3_receiver_state_t *state = TSTATE(self);
(void) (self);

packet_mask *packet = (packet_mask *) (rawBufMut(c->payload));

volatile int x = sizeof(unsigned int);
(void)x;
/* im not sure these checks are necessary */
if (kCheckPackets)
{
Expand All @@ -49,7 +51,7 @@ static void upStream(tunnel_t *self, context_t *c)
return;
}
}
else if (packet->ip4_header.version == 6)
else if (packet->ip6_header.version == 6)
{

if (WW_UNLIKELY(bufLen(c->payload) < sizeof(struct ipv6header)))
Expand Down
5 changes: 4 additions & 1 deletion tunnels/shared/layer3/packet_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ struct ipv6header
#if __BIG_ENDIAN__
uint32_t version : 4, traffic_class : 8, flow_label : 20;
#else
uint32_t flow_label : 20, traffic_class : 8, version : 4;
// uint32_t flow_label : 20;
// uint32_t traffic_class : 8;
uint32_t useless : 4;
uint32_t version : 4;
#endif
uint16_t payload_len; // Payload Length
uint8_t nexthdr; // Next Header
Expand Down

0 comments on commit 84878da

Please sign in to comment.