Initialize struct ip and icmp
This commit is contained in:
parent
3b3bdf72d4
commit
9ab8d025ca
1 changed files with 8 additions and 3 deletions
11
src/route.c
11
src/route.c
|
@ -115,13 +115,16 @@ static void swap_mac_addresses(vpn_packet_t *packet) {
|
||||||
/* RFC 792 */
|
/* RFC 792 */
|
||||||
|
|
||||||
static void route_ipv4_unreachable(node_t *source, vpn_packet_t *packet, length_t ether_size, uint8_t type, uint8_t code) {
|
static void route_ipv4_unreachable(node_t *source, vpn_packet_t *packet, length_t ether_size, uint8_t type, uint8_t code) {
|
||||||
struct ip ip = {0};
|
struct ip ip;
|
||||||
struct icmp icmp = {0};
|
struct icmp icmp;
|
||||||
|
|
||||||
struct in_addr ip_src;
|
struct in_addr ip_src;
|
||||||
struct in_addr ip_dst;
|
struct in_addr ip_dst;
|
||||||
uint32_t oldlen;
|
uint32_t oldlen;
|
||||||
|
|
||||||
|
memset(&ip, 0x00, sizeof(struct ip));
|
||||||
|
memset(&icmp, 0x00, sizeof(struct icmp));
|
||||||
|
|
||||||
if(ratelimit(3))
|
if(ratelimit(3))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -210,7 +213,7 @@ static void route_ipv4_unreachable(node_t *source, vpn_packet_t *packet, length_
|
||||||
|
|
||||||
static void route_ipv6_unreachable(node_t *source, vpn_packet_t *packet, length_t ether_size, uint8_t type, uint8_t code) {
|
static void route_ipv6_unreachable(node_t *source, vpn_packet_t *packet, length_t ether_size, uint8_t type, uint8_t code) {
|
||||||
struct ip6_hdr ip6;
|
struct ip6_hdr ip6;
|
||||||
struct icmp6_hdr icmp6 = {0};
|
struct icmp6_hdr icmp6;
|
||||||
uint16_t checksum;
|
uint16_t checksum;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
@ -220,6 +223,8 @@ static void route_ipv6_unreachable(node_t *source, vpn_packet_t *packet, length_
|
||||||
uint32_t next;
|
uint32_t next;
|
||||||
} pseudo;
|
} pseudo;
|
||||||
|
|
||||||
|
memset(&icmp6, 0x00, sizeof(struct icmp6_hdr));
|
||||||
|
|
||||||
if(ratelimit(3))
|
if(ratelimit(3))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue