mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-29 15:43:56 +00:00
Minor bug fixes, mostly todo with uninitialised variables.
This commit is contained in:
parent
59a0a4a2a0
commit
a2bcb56e1f
1
mphlr.h
1
mphlr.h
@ -334,3 +334,4 @@ int readBatmanPeerFile(char *file_path,in_addr_t peers[],int *peer_count,int pee
|
||||
int getBatmanPeerList(char *socket_path,in_addr_t peers[],int *peer_count,int peer_max);
|
||||
int hlrDump(unsigned char *hlr,int hofs);
|
||||
int peerAddress(char *did,char *sid,int flags);
|
||||
int fixResponses(struct response_set *responses);
|
||||
|
@ -136,7 +136,7 @@ int packetMakeHeader(unsigned char *packet,int packet_maxlen,int *packet_len,
|
||||
for(i=0;i<TRANSID_SIZE;i++) packet[OFS_TRANSIDFIELD+i]=random()&0xff;
|
||||
|
||||
/* payload rotation (not yet applied) */
|
||||
packet[14]=0x00;
|
||||
packet[OFS_ROTATIONFIELD]=0x00;
|
||||
|
||||
*packet_len=HEADERFIELDS_LEN;
|
||||
|
||||
|
2
peers.c
2
peers.c
@ -93,6 +93,8 @@ int sendToPeers(unsigned char *packet,int packet_len,int method,int peerId,struc
|
||||
int n=0;
|
||||
int ret;
|
||||
struct sockaddr_in peer_addr;
|
||||
|
||||
bzero(&peer_addr, sizeof(peer_addr));
|
||||
peer_addr.sin_family=AF_INET;
|
||||
peer_addr.sin_port = htons(4110);
|
||||
|
||||
|
4
server.c
4
server.c
@ -102,7 +102,6 @@ int server(char *backing_file,int size,int foregroundMode)
|
||||
pollfd fds;
|
||||
int len;
|
||||
|
||||
client_port=((struct sockaddr_in*)&recvaddr)->sin_port;
|
||||
bzero((void *)&recvaddr,sizeof(recvaddr));
|
||||
fds.fd=sock; fds.events=POLLIN;
|
||||
|
||||
@ -110,7 +109,10 @@ int server(char *backing_file,int size,int foregroundMode)
|
||||
while (poll(&fds,1,1000)<1) sleep(0);
|
||||
|
||||
len=recvfrom(sock,buffer,sizeof(buffer),0,&recvaddr,&recvaddrlen);
|
||||
|
||||
client_port=((struct sockaddr_in*)&recvaddr)->sin_port;
|
||||
client_addr=((struct sockaddr_in*)&recvaddr)->sin_addr;
|
||||
|
||||
if (debug) fprintf(stderr,"Received packet from %s (len=%d).\n",inet_ntoa(client_addr),len);
|
||||
if (debug>1) dump("recvaddr",(unsigned char *)&recvaddr,recvaddrlen);
|
||||
if (debug>3) dump("packet",(unsigned char *)buffer,len);
|
||||
|
Loading…
x
Reference in New Issue
Block a user