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)
This commit is contained in:
Luigi Rizzo 2012-08-01 18:52:07 +00:00
parent 71ca24f182
commit f5705b527d
2 changed files with 12 additions and 10 deletions

View file

@ -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",

View file

@ -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) {