From 15efb3237e9a81439bd1d63e4b7435c7c82f81c5 Mon Sep 17 00:00:00 2001 From: luigi Date: Wed, 1 Aug 2012 18:52:07 +0000 Subject: replace inet_ntoa_r with the more standard inet_ntop(). As discussed on -current, inet_ntoa_r() is non standard, has different arguments in userspace and kernel, and almost unused (no clients in userspace, only net/flowtable.c, net/if_llatbl.c, netinet/in_pcb.c, netinet/tcp_subr.c in the kernel) --- sys/netinet/ipfw/ip_fw_dynamic.c | 18 ++++++++++-------- sys/netinet/ipfw/ip_fw_log.c | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/sys/netinet/ipfw/ip_fw_dynamic.c b/sys/netinet/ipfw/ip_fw_dynamic.c index 7cff94f..edf7639 100644 --- a/sys/netinet/ipfw/ip_fw_dynamic.c +++ b/sys/netinet/ipfw/ip_fw_dynamic.c @@ -275,9 +275,9 @@ unlink_dyn_rule_print(struct ipfw_flow_id *id) #endif { da.s_addr = htonl(id->src_ip); - inet_ntoa_r(da, src); + inet_ntop(AF_INET, &da, src, sizeof(src)); da.s_addr = htonl(id->dst_ip); - inet_ntoa_r(da, dst); + inet_ntop(AF_INET, &da, dst, sizeof(dst)); } printf("ipfw: unlink entry %s %d -> %s %d, %d left\n", src, id->src_port, dst, id->dst_port, V_dyn_count - 1); @@ -656,9 +656,9 @@ add_dyn_rule(struct ipfw_flow_id *id, u_int8_t dyn_type, struct ip_fw *rule) #endif { da.s_addr = htonl(r->id.src_ip); - inet_ntoa_r(da, src); + inet_ntop(AF_INET, &da, src, sizeof(src)); da.s_addr = htonl(r->id.dst_ip); - inet_ntoa_r(da, dst); + inet_ntop(AF_INET, &da, dst, sizeof(dst)); } printf("ipfw: add dyn entry ty %d %s %d -> %s %d, total %d\n", dyn_type, src, r->id.src_port, dst, r->id.dst_port, @@ -740,9 +740,9 @@ ipfw_install_state(struct ip_fw *rule, ipfw_insn_limit *cmd, #endif { da.s_addr = htonl(args->f_id.src_ip); - inet_ntoa_r(da, src); + inet_ntop(AF_INET, &da, src, sizeof(src)); da.s_addr = htonl(args->f_id.dst_ip); - inet_ntoa_r(da, dst); + inet_ntop(AF_INET, &da, dst, sizeof(dst)); } printf("ipfw: %s: type %d %s %u -> %s %u\n", __func__, cmd->o.opcode, src, args->f_id.src_port, @@ -850,10 +850,12 @@ ipfw_install_state(struct ip_fw *rule, ipfw_insn_limit *cmd, { da.s_addr = htonl(args->f_id.src_ip); - inet_ntoa_r(da, src); + inet_ntop(AF_INET, &da, src, + sizeof(src)); da.s_addr = htonl(args->f_id.dst_ip); - inet_ntoa_r(da, dst); + inet_ntop(AF_INET, &da, dst, + sizeof(dst)); } log(LOG_SECURITY | LOG_DEBUG, "ipfw: %d %s %s:%u -> %s:%u, %s\n", diff --git a/sys/netinet/ipfw/ip_fw_log.c b/sys/netinet/ipfw/ip_fw_log.c index 14eb2a2..95b8a25 100644 --- a/sys/netinet/ipfw/ip_fw_log.c +++ b/sys/netinet/ipfw/ip_fw_log.c @@ -450,8 +450,8 @@ ipfw_log(struct ip_fw *f, u_int hlen, struct ip_fw_args *args, tcp = L3HDR(struct tcphdr, ip); udp = L3HDR(struct udphdr, ip); - inet_ntoa_r(ip->ip_src, src); - inet_ntoa_r(ip->ip_dst, dst); + inet_ntop(AF_INET, &ip->ip_src, src, sizeof(src)); + inet_ntop(AF_INET, &ip->ip_dst, dst, sizeof(dst)); } switch (args->f_id.proto) { -- cgit v1.1