fix: remove useless check
This commit is contained in:
@@ -77,12 +77,10 @@ static int preload(struct setting const *settings, int sockfd, char const *packe
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_reply(struct sockaddr_in const *me, struct sockaddr_in const *sender, struct icmphdr *sent_hdr, struct icmphdr *recv_hdr, size_t sent_size, ssize_t recv_size)
|
static int check_reply(struct icmphdr *sent_hdr, struct icmphdr *recv_hdr, size_t sent_size, ssize_t recv_size)
|
||||||
{
|
{
|
||||||
if (recv_size < (ssize_t) sizeof(struct icmphdr))
|
if (recv_size < (ssize_t) sizeof(struct icmphdr))
|
||||||
return 1;
|
return 1;
|
||||||
if (memcmp(sender, me, sizeof(struct sockaddr_in)))
|
|
||||||
return 1;
|
|
||||||
if (recv_hdr->type == 8)
|
if (recv_hdr->type == 8)
|
||||||
return 1;
|
return 1;
|
||||||
if ((size_t) recv_size != sent_size)
|
if ((size_t) recv_size != sent_size)
|
||||||
@@ -157,7 +155,7 @@ int main(int ac, char **av)
|
|||||||
struct icmphdr *recv_hdr = (struct icmphdr *) (buffer + sizeof(struct iphdr));
|
struct icmphdr *recv_hdr = (struct icmphdr *) (buffer + sizeof(struct iphdr));
|
||||||
recv_size -= sizeof(struct iphdr);
|
recv_size -= sizeof(struct iphdr);
|
||||||
|
|
||||||
if (check_reply(&settings.dest.ip, &sender, (struct icmphdr *) packet, recv_hdr, packet_size, recv_size))
|
if (check_reply((struct icmphdr *) packet, recv_hdr, packet_size, recv_size))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (recv_hdr->type == 0)
|
if (recv_hdr->type == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user