From 439dd913f16cfd9b4682dd6311d98d33f0308f35 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 12 Oct 2009 18:52:02 +0200 Subject: [PATCH] pknock: fix pknlusr compile warnings pknlusr.c: In function "main": pknlusr.c:81:25: warning: cast to pointer from integer of different size pknlusr.c:81:7: warning: cast to pointer from integer of different size --- extensions/pknock/pknlusr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extensions/pknock/pknlusr.c b/extensions/pknock/pknlusr.c index 1b99166..01ddcdc 100644 --- a/extensions/pknock/pknlusr.c +++ b/extensions/pknock/pknlusr.c @@ -4,7 +4,7 @@ #include #include #include - +#include #include #include @@ -28,7 +28,8 @@ int main() { int i, buf_size; - char *ip; + const char *ip; + char ipbuf[48]; sock_fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); @@ -78,7 +79,7 @@ int main() { nlmsg = (struct xt_pknock_nl_msg *) (buf + sizeof(struct cn_msg) + sizeof(struct nlmsghdr)); - ip = (char *)inet_ntoa((struct in_addr *) htonl(nlmsg->peer_ip)); + ip = inet_ntop(AF_INET, &nlmsg->peer_ip, ipbuf, sizeof(ipbuf)); printf("rule_name: %s - ip %s\n", nlmsg->rule_name, ip); }