defuse global variable madness

changes/54/3254/1
Richard Fuchs 12 years ago
parent 95b8a26eef
commit c94d65e00c

@ -18,25 +18,14 @@
#include <stdlib.h> #include <stdlib.h>
#include "headers.h" #include "headers.h"
int sock_packet, iface = 2; /* Socket descripter & transmit interface index */ int iface = 2; /* Socket descripter & transmit interface index */
struct sockaddr_ll ll = { 0 }; /* Socket address structure */ struct sockaddr_ll ll = { 0 }; /* Socket address structure */
u_int16_t vlan = 0; u_int16_t vlan = 0;
u_int8_t l3_tos = 0; u_int8_t l3_tos = 0;
u_int16_t l2_hdr_size = 14; u_int16_t l2_hdr_size = 14;
u_int16_t l3_hdr_size = 20; u_int16_t l3_hdr_size = 20;
u_int16_t l4_hdr_size = 8; u_int16_t l4_hdr_size = 8;
u_int16_t dhcp_hdr_size = sizeof(struct dhcpv4_hdr);
/* All protocheader sizes */
/* DHCP packet, option buffer and size of option buffer */
u_char dhcp_packet_disc[1518] = { 0 };
u_char dhcp_packet_offer[1518] = { 0 };
u_char dhcp_packet_request[1518] = { 0 };
u_char dhcp_packet_ack[1518] = { 0 };
u_char dhcp_packet_release[1518] = { 0 };
u_int32_t dhopt_size = { 0 };
u_char dhmac[ETHER_ADDR_LEN] = { 0 }; u_char dhmac[ETHER_ADDR_LEN] = { 0 };
u_char dmac[ETHER_ADDR_LEN]; u_char dmac[ETHER_ADDR_LEN];

@ -26,6 +26,10 @@ static unsigned char dhcp_packet_offer[1518] = { 0 };
static unsigned char dhcp_packet_request[1518] = { 0 }; static unsigned char dhcp_packet_request[1518] = { 0 };
static unsigned char dhcp_packet_ack[1518] = { 0 }; static unsigned char dhcp_packet_ack[1518] = { 0 };
static unsigned char dhcp_packet_release[1518] = { 0 }; static unsigned char dhcp_packet_release[1518] = { 0 };
static u_int16_t dhcp_hdr_size = sizeof(struct dhcpv4_hdr);
static u_int32_t dhopt_size = { 0 };
static struct sockaddr_ll ll = { 0 }; /* Socket address structure */
static int sock_packet;
/* /*

@ -312,8 +312,6 @@ struct dhcpv4_hdr
#define MINIMUM_PACKET_SIZE 300 #define MINIMUM_PACKET_SIZE 300
//Defined in dhtest.c //Defined in dhtest.c
extern int sock_packet;
extern struct sockaddr_ll ll;
extern int iface; extern int iface;
extern u_int16_t vlan; extern u_int16_t vlan;
extern u_int8_t l3_tos; extern u_int8_t l3_tos;
@ -321,11 +319,9 @@ extern u_int8_t l3_tos;
extern u_int16_t l2_hdr_size; extern u_int16_t l2_hdr_size;
extern u_int16_t l3_hdr_size; extern u_int16_t l3_hdr_size;
extern u_int16_t l4_hdr_size; extern u_int16_t l4_hdr_size;
extern u_int16_t dhcp_hdr_size;
extern u_int16_t fqdn_n; extern u_int16_t fqdn_n;
extern u_int16_t fqdn_s; extern u_int16_t fqdn_s;
extern u_int32_t dhopt_size;
extern u_int32_t dhcp_xid; extern u_int32_t dhcp_xid;
extern int bcast_flag; extern int bcast_flag;
extern int timeout; extern int timeout;

Loading…
Cancel
Save