clean: upgrade readability

This commit is contained in:
Starnakin 2025-05-27 13:25:37 +02:00
parent ad367d6792
commit e7ca63eaa6

View File

@ -19,33 +19,22 @@ static void dispatch_callback(u_char *user, const struct pcap_pkthdr *h,
const struct scan *data = (struct scan *)user;
const struct iphdr *iphdr =
(struct iphdr *)(bytes + sizeof(struct ether_header));
const void *packet = bytes + sizeof(struct ether_header) + sizeof(struct iphdr);
if (iphdr->protocol == IPPROTO_TCP &&
h->caplen >= sizeof(struct ether_header) + sizeof(struct iphdr) +
sizeof(struct tcphdr)) {
tcp_response(
(const struct tcphdr *)(bytes +
sizeof(struct ether_header) +
sizeof(struct iphdr)),
data);
tcp_response(packet, data);
}
if (iphdr->protocol == IPPROTO_UDP &&
h->caplen >= sizeof(struct ether_header) + sizeof(struct iphdr) +
sizeof(struct udphdr)) {
udp_response(
(const struct udphdr *)(bytes +
sizeof(struct ether_header) +
sizeof(struct iphdr)),
data);
udp_response(packet, data);
}
if (iphdr->protocol == IPPROTO_ICMP &&
h->caplen >= sizeof(struct ether_header) + sizeof(struct iphdr) +
sizeof(struct icmphdr)) {
icmp_response(
(const struct icmphdr *)(bytes +
sizeof(struct ether_header) +
sizeof(struct iphdr)),
data);
icmp_response(packet, data);
}
}