fixed response
This commit is contained in:
@@ -184,6 +184,7 @@ void send_status(unsigned char *buf, int code){
|
|||||||
char *data = calloc(1, strlen(prefix)+len+2);
|
char *data = calloc(1, strlen(prefix)+len+2);
|
||||||
|
|
||||||
//setup the data
|
//setup the data
|
||||||
|
memset(&frame, 0, sizeof(frame));
|
||||||
snprintf(ccode, len+1, "%d", code);
|
snprintf(ccode, len+1, "%d", code);
|
||||||
strncpy(data, prefix, strlen(prefix));
|
strncpy(data, prefix, strlen(prefix));
|
||||||
strncat(data, ccode, len+1);
|
strncat(data, ccode, len+1);
|
||||||
@@ -191,7 +192,6 @@ void send_status(unsigned char *buf, int code){
|
|||||||
strncpy(frame.data, data, strlen(data));
|
strncpy(frame.data, data, strlen(data));
|
||||||
|
|
||||||
//get the ifindex
|
//get the ifindex
|
||||||
memset(&frame, 0, sizeof(frame));
|
|
||||||
if (ioctl(sockfd, SIOCGIFINDEX, sifreq) == -1){
|
if (ioctl(sockfd, SIOCGIFINDEX, sifreq) == -1){
|
||||||
perror("ioctl SIOCGIFINDEX");
|
perror("ioctl SIOCGIFINDEX");
|
||||||
return;
|
return;
|
||||||
@@ -224,7 +224,7 @@ void send_status(unsigned char *buf, int code){
|
|||||||
frame.udp.len = htons(strlen(data) + sizeof(frame.udp));
|
frame.udp.len = htons(strlen(data) + sizeof(frame.udp));
|
||||||
|
|
||||||
//checksums
|
//checksums
|
||||||
udp_checksum(&frame.ip, (unsigned short*)&frame.udp);
|
//udp_checksum(&frame.ip, (unsigned short*)&frame.udp);
|
||||||
ip_checksum(&frame.ip);
|
ip_checksum(&frame.ip);
|
||||||
|
|
||||||
//calculate total length and send
|
//calculate total length and send
|
||||||
|
|||||||
Reference in New Issue
Block a user