Make the log prints less debug-like and more sysadmin-friendly.
This commit is contained in:
parent
e1262cd563
commit
a68c8cb64c
@ -82,8 +82,6 @@ static int arp_open_fd(struct client_state_t *cs)
|
||||
|
||||
using_arp_bpf = setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &sfp_arp,
|
||||
sizeof sfp_arp) != -1;
|
||||
if (using_arp_bpf)
|
||||
log_line("Attached filter to raw ARP socket fd %d", fd);
|
||||
|
||||
int opt = 1;
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &opt, sizeof opt) == -1) {
|
||||
|
@ -236,7 +236,6 @@ static void copy_ifdata(struct nlmsghdr *msg, void **args)
|
||||
if (!strncmp(client_config.interface,
|
||||
(char *)RTA_DATA(rta), RTA_PAYLOAD(rta))) {
|
||||
client_config.ifindex = ifinfo->ifi_index;
|
||||
log_line("adapter index %d", ifinfo->ifi_index);
|
||||
found |= 1;
|
||||
}
|
||||
break;
|
||||
@ -246,10 +245,6 @@ static void copy_ifdata(struct nlmsghdr *msg, void **args)
|
||||
/* We can only handle ethernet like devices with 6 octet MAC */
|
||||
if (RTA_PAYLOAD(rta) == 6) {
|
||||
memcpy(client_config.arp, RTA_DATA(rta), 6);
|
||||
log_line("adapter hardware address %02x:%02x:%02x:%02x:%02x:%02x",
|
||||
client_config.arp[0], client_config.arp[1],
|
||||
client_config.arp[2], client_config.arp[3],
|
||||
client_config.arp[4], client_config.arp[5]);
|
||||
found |= 2;
|
||||
}
|
||||
break;
|
||||
|
@ -106,8 +106,6 @@ static int create_udp_socket(uint32_t ip, uint16_t port, char *iface)
|
||||
// on success, or -1 on failure.
|
||||
static int create_udp_listen_socket(struct client_state_t *cs, char *inf)
|
||||
{
|
||||
log_line("Opening listen socket on 0x%08x:%d %s", INADDR_ANY,
|
||||
DHCP_CLIENT_PORT, inf);
|
||||
int fd = create_udp_socket(INADDR_ANY, DHCP_CLIENT_PORT, inf);
|
||||
if (fd == -1)
|
||||
return -1;
|
||||
@ -169,7 +167,6 @@ static int get_cooked_packet(struct dhcpmsg *packet, int fd)
|
||||
log_line("Read on listen socket failed: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
log_line("Received a packet via cooked socket.");
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@ -297,8 +294,6 @@ static int get_raw_packet(struct client_state_t *cs, struct dhcpmsg *payload)
|
||||
|
||||
size_t l = ntohs(packet.ip.tot_len) - sizeof packet.ip - sizeof packet.udp;
|
||||
memcpy(payload, &packet.data, l);
|
||||
|
||||
log_line("Received a packet via raw socket.");
|
||||
return l;
|
||||
}
|
||||
|
||||
@ -313,10 +308,9 @@ static int create_raw_socket(struct client_state_t *cs, struct sockaddr_ll *sa,
|
||||
|
||||
if (cs) {
|
||||
if (filter_prog && (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER,
|
||||
filter_prog, sizeof *filter_prog) != -1)) {
|
||||
filter_prog, sizeof *filter_prog) != -1))
|
||||
cs->using_dhcp_bpf = 1;
|
||||
log_line("Attached filter to raw socket fd %d", fd);
|
||||
} else
|
||||
else
|
||||
cs->using_dhcp_bpf = 0;
|
||||
}
|
||||
|
||||
@ -379,8 +373,6 @@ static int create_raw_listen_socket(struct client_state_t *cs, int ifindex)
|
||||
.len = sizeof sf_dhcp / sizeof sf_dhcp[0],
|
||||
.filter = (struct sock_filter *)sf_dhcp,
|
||||
};
|
||||
|
||||
log_line("Opening raw socket on ifindex %d", ifindex);
|
||||
struct sockaddr_ll sa = {
|
||||
.sll_family = AF_PACKET,
|
||||
.sll_protocol = htons(ETH_P_IP),
|
||||
@ -538,6 +530,7 @@ void handle_packet(struct client_state_t *cs)
|
||||
|
||||
if (!validate_dhcp_packet(cs, len, &packet, &message))
|
||||
return;
|
||||
log_line("Received a reply.");
|
||||
packet_action(cs, &packet, message);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user