1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
--- ppp-2.4.2/pppd/plugins/dhcp/dhcpc.c
+++ ppp-2.4.2/pppd/plugins/dhcp/dhcpc.c
@@ -144,7 +144,7 @@
fd = raw_socket(client_config.ifindex);
if (listen_mode != LISTEN_NONE && fd < 0) {
- fatal("DHCPC: couldn't listen on socket, %s", sys_errlist[errno]);
+ fatal("DHCPC: couldn't listen on socket, %s", strerror(errno));
}
}
@@ -208,7 +208,7 @@
len = get_packet(&packet, fd);
if (len == -1 && errno != EINTR) {
- dbglog("DHCPC: error on read, %s, reopening socket", sys_errlist[errno]);
+ dbglog("DHCPC: error on read, %s, reopening socket", strerror(errno));
change_mode(LISTEN_KERNEL);
}
if (len < 0) continue;
@@ -380,7 +380,7 @@
else len = get_raw_packet(&packet, fd);
if (len == -1 && errno != EINTR) {
- dbglog("DHCPC: error on read, %s, reopening socket", sys_errlist[errno]);
+ dbglog("DHCPC: error on read, %s, reopening socket", strerror(errno));
change_mode(listen_mode); /* just close and reopen */
}
if (len < 0) continue;
@@ -445,7 +445,7 @@
} else {
/* An error occured */
- dbglog("DHCPC: error on select, %s, reopening socket", sys_errlist[errno]);
+ dbglog("DHCPC: error on select, %s, reopening socket", strerror(errno));
change_mode(listen_mode); /* just close and reopen */
}
--- ppp-2.4.2/pppd/plugins/dhcp/packet.c
+++ ppp-2.4.2/pppd/plugins/dhcp/packet.c
@@ -125,7 +125,7 @@
return kernel_packet(payload,payload->giaddr,CLIENT_PORT,dest_ip,dest_port);
if ((fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP))) < 0) {
- DEBUG(LOG_ERR, "socket call failed: %s", sys_errlist[errno]);
+ DEBUG(LOG_ERR, "socket call failed: %s", strerror(errno));
return -1;
}
@@ -138,7 +138,7 @@
dest.sll_halen = 6;
memcpy(dest.sll_addr, dest_arp, 6);
if (bind(fd, (struct sockaddr *)&dest, sizeof(struct sockaddr_ll)) < 0) {
- DEBUG(LOG_ERR, "bind call failed: %s", sys_errlist[errno]);
+ DEBUG(LOG_ERR, "bind call failed: %s", strerror(errno));
close(fd);
return -1;
}
@@ -161,7 +161,7 @@
result = sendto(fd, &packet, sizeof(struct udp_dhcp_packet), 0, (struct sockaddr *) &dest, sizeof(dest));
if (result <= 0) {
- DEBUG(LOG_ERR, "write on socket failed: %s", sys_errlist[errno]);
+ DEBUG(LOG_ERR, "write on socket failed: %s", strerror(errno));
}
close(fd);
return result;
--- ppp-2.4.2/pppd/plugins/dhcp/socket.c
+++ ppp-2.4.2/pppd/plugins/dhcp/socket.c
@@ -60,7 +60,7 @@
*addr = sin->sin_addr.s_addr;
DEBUG(LOG_INFO, "%s (our ip) = %s", ifr.ifr_name, inet_ntoa(sin->sin_addr));
} else {
- LOG(LOG_ERR, "SIOCGIFADDR failed!: %s", sys_errlist[errno]);
+ LOG(LOG_ERR, "SIOCGIFADDR failed!: %s", strerror(errno));
return -1;
}
}
@@ -69,7 +69,7 @@
DEBUG(LOG_INFO, "adapter index %d", ifr.ifr_ifindex);
*ifindex = ifr.ifr_ifindex;
} else {
- LOG(LOG_ERR, "SIOCGIFINDEX failed!: %s", sys_errlist[errno]);
+ LOG(LOG_ERR, "SIOCGIFINDEX failed!: %s", strerror(errno));
return -1;
}
if (ioctl(fd, SIOCGIFHWADDR, &ifr) == 0) {
@@ -77,11 +77,11 @@
DEBUG(LOG_INFO, "adapter hardware address %02x:%02x:%02x:%02x:%02x:%02x",
arp[0], arp[1], arp[2], arp[3], arp[4], arp[5]);
} else {
- LOG(LOG_ERR, "SIOCGIFHWADDR failed!: %s", sys_errlist[errno]);
+ LOG(LOG_ERR, "SIOCGIFHWADDR failed!: %s", strerror(errno));
return -1;
}
} else {
- LOG(LOG_ERR, "socket failed!: %s", sys_errlist[errno]);
+ LOG(LOG_ERR, "socket failed!: %s", strerror(errno));
return -1;
}
close(fd);
@@ -98,7 +98,7 @@
DEBUG(LOG_INFO, "Opening listen socket on 0x%08x:%d %s\n", ip, port, inf ? inf : "*");
if ((fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
- DEBUG(LOG_ERR, "socket call failed: %s", sys_errlist[errno]);
+ DEBUG(LOG_ERR, "socket call failed: %s", strerror(errno));
return -1;
}
@@ -144,7 +144,7 @@
DEBUG(LOG_INFO, "Opening raw socket on ifindex %d\n", ifindex);
if ((fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP))) < 0) {
- DEBUG(LOG_ERR, "socket call failed: %s", sys_errlist[errno]);
+ DEBUG(LOG_ERR, "socket call failed: %s", strerror(errno));
return -1;
}
@@ -152,7 +152,7 @@
sock.sll_protocol = htons(ETH_P_IP);
sock.sll_ifindex = ifindex;
if (bind(fd, (struct sockaddr *) &sock, sizeof(sock)) < 0) {
- DEBUG(LOG_ERR, "bind call failed: %s", sys_errlist[errno]);
+ DEBUG(LOG_ERR, "bind call failed: %s", strerror(errno));
close(fd);
return -1;
}
|