diff options
-rw-r--r-- | src/icmp.c | 10 | ||||
-rw-r--r-- | src/icmp.h | 2 | ||||
-rw-r--r-- | src/lua/lua-client.c | 2 | ||||
-rw-r--r-- | src/mtu.c | 8 | ||||
-rw-r--r-- | src/netlink.c | 4 | ||||
-rw-r--r-- | src/netlink.h | 2 | ||||
-rw-r--r-- | src/pingu_host.c | 2 | ||||
-rw-r--r-- | src/pinguctl.c | 2 |
8 files changed, 20 insertions, 12 deletions
@@ -1,10 +1,12 @@ +#include <time.h> #include <errno.h> #include <netdb.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> -#include <asm/types.h> +#include <sys/types.h> #include <arpa/inet.h> #include <netinet/ip.h> #include <netinet/ip_icmp.h> @@ -13,7 +15,6 @@ static char *pr_addr(__u32 addr) { - struct hostent *hp; static char buf[4096]; sprintf(buf, "%s", inet_ntoa(*(struct in_addr *)&addr)); @@ -300,10 +301,9 @@ int icmp_send_ping(int fd, struct sockaddr *to, int tolen, return icmp_send(fd, to, tolen, (void *) packet, len); } -int icmp_read_reply(int fd, struct sockaddr *from, int fromlen, +int icmp_read_reply(int fd, struct sockaddr *from, socklen_t fromlen, __u8 *buf, int buflen) { - struct iovec iov; int len; len = recvfrom(fd, buf, buflen, 0, from, &fromlen); @@ -318,7 +318,7 @@ int icmp_read_reply(int fd, struct sockaddr *from, int fromlen, int icmp_open(float timeout) { - const int pmtudisc = IP_PMTUDISC_DO, yes = 1; + const int pmtudisc = IP_PMTUDISC_DO; struct timeval tv; int fd; @@ -13,7 +13,7 @@ int icmp_send_frag_needed(int fd, struct sockaddr *to, int tolen, struct iphdr *iph, int newmtu); int icmp_send_ping(int fd, struct sockaddr *to, int tolen, int seq, int total_size); -int icmp_read_reply(int fd, struct sockaddr *from, int fromlen, +int icmp_read_reply(int fd, struct sockaddr *from, socklen_t fromlen, __u8 *buf, int buflen); int icmp_open(float timeout); void icmp_close(int fd); diff --git a/src/lua/lua-client.c b/src/lua/lua-client.c index ad18f30..bc9fce0 100644 --- a/src/lua/lua-client.c +++ b/src/lua/lua-client.c @@ -1,9 +1,9 @@ - #include <sys/socket.h> #include <sys/un.h> #include <errno.h> #include <stdio.h> +#include <string.h> #include <unistd.h> #include <lua.h> @@ -4,12 +4,16 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <sys/ioctl.h> #include <linux/if.h> #include <linux/sockios.h> + +#include <arpa/inet.h> #include <netinet/ip_icmp.h> #include "icmp.h" +#include "netlink.h" static int fd, mtu_size; static struct sockaddr_in to; @@ -142,7 +146,7 @@ static void do_discover_and_write(void) return; } - if (!netlink_route_get(&to, NULL, iface)) { + if (!netlink_route_get((struct sockaddr*) &to, NULL, iface)) { fprintf(stderr, "Failed to determine route interface\n"); return; } @@ -184,7 +188,7 @@ static void do_inject_pmtu(void) { u_int16_t mtu; - if (!netlink_route_get(&to, &mtu, NULL)) { + if (!netlink_route_get((struct sockaddr*) &to, &mtu, NULL)) { fprintf(stderr, "Failed to determine Path MTU\n"); return; } diff --git a/src/netlink.c b/src/netlink.c index 5e43116..6e13599 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -1,10 +1,12 @@ +#include <time.h> #include <errno.h> #include <stdio.h> +#include <fcntl.h> #include <unistd.h> #include <string.h> + #include <sys/types.h> #include <sys/ioctl.h> -#include <sys/fcntl.h> #include <sys/socket.h> #include <netinet/in.h> diff --git a/src/netlink.h b/src/netlink.h index 4e2ceb2..115d59a 100644 --- a/src/netlink.h +++ b/src/netlink.h @@ -1,6 +1,8 @@ #ifndef PINGU_NETLINK_H #define PINGU_NETLINK_H +#include <sys/types.h> + int netlink_route_get(struct sockaddr *dst, u_int16_t *mtu, char *ifname); #endif diff --git a/src/pingu_host.c b/src/pingu_host.c index 5887996..b2b59a4 100644 --- a/src/pingu_host.c +++ b/src/pingu_host.c @@ -37,7 +37,7 @@ void execute_action(const char *action) return; } if (pid == 0) { - execl(shell, shell, "-c", action, NULL); + execl(shell, shell, "-c", action, (void*) NULL); log_perror(action); exit(1); } diff --git a/src/pinguctl.c b/src/pinguctl.c index 02dbe14..ea59f8a 100644 --- a/src/pinguctl.c +++ b/src/pinguctl.c @@ -1,9 +1,9 @@ - #include <sys/socket.h> #include <sys/un.h> #include <errno.h> #include <stdio.h> +#include <string.h> #include <unistd.h> #include "log.h" |