Skip to content

Commit

Permalink
Merge pull request #6 from infrastation/master
Browse files Browse the repository at this point in the history
address some more warnings
  • Loading branch information
eribertomota authored Sep 19, 2024
2 parents bf1d8b2 + af8aa76 commit c724adb
Show file tree
Hide file tree
Showing 15 changed files with 112 additions and 176 deletions.
2 changes: 1 addition & 1 deletion src/dns_plugin.plug
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ udp_start = PLD->PL_info.IP_len;
len=PLD->PL_info.IP_len + PLD->PL_info.UDP_len + PLD->PL_info.DATA_len;
dns_iphead= (struct IP_header *) dns_buffer;
dns_udphead= (struct UDP_header *) (dns_buffer+udp_start);
dns_dnshead= (struct DNS_header *) (dns_buffer+udp_start+sizeof(struct UDP_header));
dns_dnshead= (struct PL_DNS_header *) (dns_buffer+udp_start+sizeof(struct UDP_header));

PL_pos_max = PLD->PL_info.DATA_len - 12;

Expand Down
10 changes: 5 additions & 5 deletions src/sn_analyse.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if(status==0) /* make a new entry unless it's reset */
{
if(finish!=TCP_FINISH)
if((dummy_pointer=add_dynam(filename, TCP, 0,ntohl(tcphead.seq_nr),info.DATA_len))==NULL)
return 1;
return;
};

if(finish==TCP_FINISH) /* let's reset the connection */
Expand All @@ -26,7 +26,7 @@ if(LOGPARAM & LOGPARAM_RAW) /* Raw logging */
if(dummy&SYN) print_conn(filename,"Connection initiated. (SYN)");
if(dummy&FIN) print_conn(filename,"Connection ending. (FIN)");
if(dummy&RST) print_conn(filename,"Connection reset. (RST)");
return 1;
return;
};

data = sp+PROTO_HEAD+info.IP_len+info.TCP_len;
Expand All @@ -40,7 +40,7 @@ if(LOGPARAM & LOGPARAM_NORM) /* NORM logging */
};
};

if((dummy&FIN)||(dummy&RST)) return 1; /* needed, cauz entry don't exist */
if((dummy&FIN)||(dummy&RST)) return; /* needed, cauz entry don't exist */

/*** TELNET *****************************************************************/
if(LOGPARAM & LOGPARAM_TELNET)
Expand Down Expand Up @@ -197,5 +197,5 @@ if( (dummy_pointer=search_dynam(filename, TCP)) !=NULL)
if(ntohl(tcphead.seq_nr)>dummy_pointer->exp_seq)
dummy_pointer->exp_seq=ntohl(tcphead.seq_nr)+info.DATA_len;
}
return 1;
return 1; /* DON'T FORGET THEM!!!! */
return;
return; /* DON'T FORGET THEM!!!! */
18 changes: 9 additions & 9 deletions src/sn_cfgfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ extern int Priority; /* The higher the priority, the more important */
extern char dot_notation[20]; /* for easy working, Q&D */
extern char Logfile[250];

void clear_list_buffer (struct cfg_file_contense *help)
static void clear_list_buffer (struct cfg_file_contense *help)
{
help->host[0]=0;
help->priority=0;
help->port=0;
help->wildcard=0;
}

struct cfg_file_contense *adjust_select_from_list (void)
static struct cfg_file_contense *adjust_select_from_list (void)
{
Priority++;
select_from_length++;
Expand All @@ -57,7 +57,7 @@ clear_list_buffer(&(select_from_list[select_from_length-1]));
return &(select_from_list[select_from_length-1]);
}

struct cfg_file_contense *adjust_select_to_list (void)
static struct cfg_file_contense *adjust_select_to_list (void)
{
Priority++;
select_to_length++;
Expand All @@ -77,7 +77,7 @@ clear_list_buffer(&(select_to_list[select_to_length-1]));
return &(select_to_list[select_to_length-1]);
}

struct cfg_file_contense *adjust_deselect_from_list (void)
static struct cfg_file_contense *adjust_deselect_from_list (void)
{
Priority++;
deselect_from_length++;
Expand All @@ -96,7 +96,7 @@ clear_list_buffer(&(deselect_from_list[deselect_from_length-1]));
return (&(deselect_from_list[deselect_from_length-1]));
}

struct cfg_file_contense *adjust_deselect_to_list (void)
static struct cfg_file_contense *adjust_deselect_to_list (void)
{
Priority++;
deselect_to_length++;
Expand All @@ -116,7 +116,7 @@ clear_list_buffer(&(deselect_to_list[deselect_to_length-1]));
return &(deselect_to_list[deselect_to_length-1]);
}

char *clean_string (char *string)
static char *clean_string (char *string)
{
char help[20];
int i, j;
Expand All @@ -140,7 +140,7 @@ strcpy(string, help);
return string;
}

char *clean_filename (char *string)
static char *clean_filename (char *string)
{
char help[20];
int i, j;
Expand All @@ -164,7 +164,7 @@ strcpy(string, help);
return string;
}

void make_nr_dot (char *host)
static void make_nr_dot (char *host)
{
_32_bit hostnr;
unsigned char *digit;
Expand Down Expand Up @@ -208,7 +208,7 @@ if (ret <= 0)
return ret;
}

void interprete_line (char *line)
static void interprete_line (char *line)
{
struct cfg_file_contense *help, *helpp;
char *field;
Expand Down
11 changes: 1 addition & 10 deletions src/sn_cfgfile.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
/* Sniffit Config File include */

void clear_list_buffer (struct cfg_file_contense *);
struct cfg_file_contense *adjust_select_from_list (void);
struct cfg_file_contense *adjust_select_to_list (void);
struct cfg_file_contense *adjust_deselect_from_list (void);
struct cfg_file_contense *adjust_deselect_to_list (void);
char *clean_string (char *);
char *clean_filename (char *);
void make_nr_dot (char *);
void interprete_line (char *);
void read_cfg_file (char *);
extern void read_cfg_file (char *);
4 changes: 2 additions & 2 deletions src/sn_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
/* #define DEBUG_ONSCREEN */

#ifdef DEBUG
void close_debug_device (void);
void debug_msg(char *);
extern void close_debug_device (void);
extern void debug_msg(char *);
#endif

22 changes: 15 additions & 7 deletions src/sn_generation.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@

extern volatile int screen_busy;

/*** forward declarations ***/
static void transmit_UDP (int, char *,
int, int,
_32_bit, unsigned short,
_32_bit, unsigned short);
static int open_sending (void);

void exec_generate(struct generate_mask *generate)
{
WINDOW *Msg_dsp;
Expand Down Expand Up @@ -126,7 +133,7 @@ forced_refresh();
#define SP_UDP_HEAD_BASE 8 /* Always fixed */


int open_sending (void)
static int open_sending (void)
{
struct protoent *sp_proto;
int sp_fd;
Expand All @@ -142,7 +149,7 @@ if ((sp_fd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW))==-1)
return sp_fd;
}

void sp_send_packet (struct sp_data_exchange *sp, unsigned char proto)
static void sp_send_packet (struct sp_data_exchange *sp, unsigned char proto)
{
int sp_status;
struct sockaddr_in sp_server;
Expand Down Expand Up @@ -182,7 +189,7 @@ if (sp_status < 0 || sp_status != sp->datalen+HEAD_BASE+SP_IP_HEAD_BASE+sp->IP_o
#endif
}

void sp_fix_IP_packet (struct sp_data_exchange *sp, unsigned char proto)
static void sp_fix_IP_packet (struct sp_data_exchange *sp, unsigned char proto)
{
struct IP_header *sp_help_ip;
int HEAD_BASE;
Expand Down Expand Up @@ -211,7 +218,7 @@ sp_help_ip->checksum=in_cksum((unsigned short *) (sp->buffer),
#endif
}

void sp_fix_TCP_packet (struct sp_data_exchange *sp)
static void sp_fix_TCP_packet (struct sp_data_exchange *sp)
{
char sp_pseudo_ip_construct[MTU];
struct TCP_header *sp_help_tcp;
Expand Down Expand Up @@ -245,7 +252,8 @@ sp_help_tcp->checksum=in_cksum((unsigned short *) sp_pseudo_ip_construct,
#endif
}

void transmit_TCP (int sp_fd, char *sp_data,
/* FIXME: dead code */
static void transmit_TCP (int sp_fd, char *sp_data,
int sp_ipoptlen, int sp_tcpoptlen, int sp_datalen,
_32_bit sp_source, unsigned short sp_source_port,
_32_bit sp_dest, unsigned short sp_dest_port,
Expand Down Expand Up @@ -285,7 +293,7 @@ sp_fix_IP_packet(&sp_struct, 6);
sp_send_packet(&sp_struct, 6);
}

void sp_fix_UDP_packet (struct sp_data_exchange *sp)
static void sp_fix_UDP_packet (struct sp_data_exchange *sp)
{
char sp_pseudo_ip_construct[MTU];
struct UDP_header *sp_help_udp;
Expand Down Expand Up @@ -316,7 +324,7 @@ sp_help_udp->checksum=in_cksum((unsigned short *) sp_pseudo_ip_construct,
#endif
}

void transmit_UDP (int sp_fd, char *sp_data,
static void transmit_UDP (int sp_fd, char *sp_data,
int sp_ipoptlen, int sp_datalen,
_32_bit sp_source, unsigned short sp_source_port,
_32_bit sp_dest, unsigned short sp_dest_port)
Expand Down
21 changes: 1 addition & 20 deletions src/sn_generation.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
/* Sniffit Packet Generation File */

void exec_generate(struct generate_mask *);

void transmit_TCP (int, char *,
int, int , int ,
_32_bit, unsigned short,
_32_bit, unsigned short,
_32_bit, _32_bit,
unsigned short);

void transmit_UDP (int, char *,
int, int,
_32_bit, unsigned short,
_32_bit, unsigned short);

int open_sending (void);

void sp_send_packet (struct sp_data_exchange *, unsigned char);
void sp_fix_TCP_packet (struct sp_data_exchange *);
void sp_fix_UDP_packet (struct sp_data_exchange *);
void sp_fix_IP_packet (struct sp_data_exchange *, unsigned char);
extern void exec_generate(struct generate_mask *);
Loading

0 comments on commit c724adb

Please sign in to comment.