Commit cffee385 authored by Harvey Harrison's avatar Harvey Harrison Committed by David S. Miller

net: replace NIPQUAD() in net/ipv4/netfilter/

Using NIPQUAD() with NIPQUAD_FMT, %d.%d.%d.%d or %u.%u.%u.%u
can be replaced with %pI4
Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 77be155c
...@@ -142,15 +142,15 @@ static inline int arp_packet_match(const struct arphdr *arphdr, ...@@ -142,15 +142,15 @@ static inline int arp_packet_match(const struct arphdr *arphdr,
ARPT_INV_TGTIP)) { ARPT_INV_TGTIP)) {
dprintf("Source or target IP address mismatch.\n"); dprintf("Source or target IP address mismatch.\n");
dprintf("SRC: %u.%u.%u.%u. Mask: %u.%u.%u.%u. Target: %u.%u.%u.%u.%s\n", dprintf("SRC: %pI4. Mask: %pI4. Target: %pI4.%s\n",
NIPQUAD(src_ipaddr), &src_ipaddr,
NIPQUAD(arpinfo->smsk.s_addr), &arpinfo->smsk.s_addr,
NIPQUAD(arpinfo->src.s_addr), &arpinfo->src.s_addr,
arpinfo->invflags & ARPT_INV_SRCIP ? " (INV)" : ""); arpinfo->invflags & ARPT_INV_SRCIP ? " (INV)" : "");
dprintf("TGT: %u.%u.%u.%u Mask: %u.%u.%u.%u Target: %u.%u.%u.%u.%s\n", dprintf("TGT: %pI4 Mask: %pI4 Target: %pI4.%s\n",
NIPQUAD(tgt_ipaddr), &tgt_ipaddr,
NIPQUAD(arpinfo->tmsk.s_addr), &arpinfo->tmsk.s_addr,
NIPQUAD(arpinfo->tgt.s_addr), &arpinfo->tgt.s_addr,
arpinfo->invflags & ARPT_INV_TGTIP ? " (INV)" : ""); arpinfo->invflags & ARPT_INV_TGTIP ? " (INV)" : "");
return 0; return 0;
} }
......
...@@ -94,15 +94,11 @@ ip_packet_match(const struct iphdr *ip, ...@@ -94,15 +94,11 @@ ip_packet_match(const struct iphdr *ip,
IPT_INV_DSTIP)) { IPT_INV_DSTIP)) {
dprintf("Source or dest mismatch.\n"); dprintf("Source or dest mismatch.\n");
dprintf("SRC: %u.%u.%u.%u. Mask: %u.%u.%u.%u. Target: %u.%u.%u.%u.%s\n", dprintf("SRC: %pI4. Mask: %pI4. Target: %pI4.%s\n",
NIPQUAD(ip->saddr), &ip->saddr, &ipinfo->smsk.s_addr, &ipinfo->src.s_addr,
NIPQUAD(ipinfo->smsk.s_addr),
NIPQUAD(ipinfo->src.s_addr),
ipinfo->invflags & IPT_INV_SRCIP ? " (INV)" : ""); ipinfo->invflags & IPT_INV_SRCIP ? " (INV)" : "");
dprintf("DST: %u.%u.%u.%u Mask: %u.%u.%u.%u Target: %u.%u.%u.%u.%s\n", dprintf("DST: %pI4 Mask: %pI4 Target: %pI4.%s\n",
NIPQUAD(ip->daddr), &ip->daddr, &ipinfo->dmsk.s_addr, &ipinfo->dst.s_addr,
NIPQUAD(ipinfo->dmsk.s_addr),
NIPQUAD(ipinfo->dst.s_addr),
ipinfo->invflags & IPT_INV_DSTIP ? " (INV)" : ""); ipinfo->invflags & IPT_INV_DSTIP ? " (INV)" : "");
return false; return false;
} }
......
...@@ -168,7 +168,7 @@ clusterip_config_init(const struct ipt_clusterip_tgt_info *i, __be32 ip, ...@@ -168,7 +168,7 @@ clusterip_config_init(const struct ipt_clusterip_tgt_info *i, __be32 ip,
char buffer[16]; char buffer[16];
/* create proc dir entry */ /* create proc dir entry */
sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip)); sprintf(buffer, "%pI4", &ip);
c->pde = proc_create_data(buffer, S_IWUSR|S_IRUSR, c->pde = proc_create_data(buffer, S_IWUSR|S_IRUSR,
clusterip_procdir, clusterip_procdir,
&clusterip_proc_fops, c); &clusterip_proc_fops, c);
...@@ -373,7 +373,7 @@ static bool clusterip_tg_check(const struct xt_tgchk_param *par) ...@@ -373,7 +373,7 @@ static bool clusterip_tg_check(const struct xt_tgchk_param *par)
config = clusterip_config_find_get(e->ip.dst.s_addr, 1); config = clusterip_config_find_get(e->ip.dst.s_addr, 1);
if (!config) { if (!config) {
if (!(cipinfo->flags & CLUSTERIP_FLAG_NEW)) { if (!(cipinfo->flags & CLUSTERIP_FLAG_NEW)) {
printk(KERN_WARNING "CLUSTERIP: no config found for %u.%u.%u.%u, need 'new'\n", NIPQUAD(e->ip.dst.s_addr)); printk(KERN_WARNING "CLUSTERIP: no config found for %pI4, need 'new'\n", &e->ip.dst.s_addr);
return false; return false;
} else { } else {
struct net_device *dev; struct net_device *dev;
...@@ -478,9 +478,8 @@ static void arp_print(struct arp_payload *payload) ...@@ -478,9 +478,8 @@ static void arp_print(struct arp_payload *payload)
} }
hbuffer[--k]='\0'; hbuffer[--k]='\0';
printk("src %u.%u.%u.%u@%s, dst %u.%u.%u.%u\n", printk("src %pI4@%s, dst %pI4\n",
NIPQUAD(payload->src_ip), hbuffer, &payload->src_ip, hbuffer, &payload->dst_ip);
NIPQUAD(payload->dst_ip));
} }
#endif #endif
......
...@@ -54,8 +54,8 @@ static void dump_packet(const struct nf_loginfo *info, ...@@ -54,8 +54,8 @@ static void dump_packet(const struct nf_loginfo *info,
/* Important fields: /* Important fields:
* TOS, len, DF/MF, fragment offset, TTL, src, dst, options. */ * TOS, len, DF/MF, fragment offset, TTL, src, dst, options. */
/* Max length: 40 "SRC=255.255.255.255 DST=255.255.255.255 " */ /* Max length: 40 "SRC=255.255.255.255 DST=255.255.255.255 " */
printk("SRC=%u.%u.%u.%u DST=%u.%u.%u.%u ", printk("SRC=%pI4 DST=%pI4 ",
NIPQUAD(ih->saddr), NIPQUAD(ih->daddr)); &ih->saddr, &ih->daddr);
/* Max length: 46 "LEN=65535 TOS=0xFF PREC=0xFF TTL=255 ID=65535 " */ /* Max length: 46 "LEN=65535 TOS=0xFF PREC=0xFF TTL=255 ID=65535 " */
printk("LEN=%u TOS=0x%02X PREC=0x%02X TTL=%u ID=%u ", printk("LEN=%u TOS=0x%02X PREC=0x%02X TTL=%u ID=%u ",
...@@ -262,8 +262,7 @@ static void dump_packet(const struct nf_loginfo *info, ...@@ -262,8 +262,7 @@ static void dump_packet(const struct nf_loginfo *info,
break; break;
case ICMP_REDIRECT: case ICMP_REDIRECT:
/* Max length: 24 "GATEWAY=255.255.255.255 " */ /* Max length: 24 "GATEWAY=255.255.255.255 " */
printk("GATEWAY=%u.%u.%u.%u ", printk("GATEWAY=%pI4 ", &ich->un.gateway);
NIPQUAD(ich->un.gateway));
/* Fall through */ /* Fall through */
case ICMP_DEST_UNREACH: case ICMP_DEST_UNREACH:
case ICMP_SOURCE_QUENCH: case ICMP_SOURCE_QUENCH:
......
...@@ -60,9 +60,8 @@ static bool ipv4_invert_tuple(struct nf_conntrack_tuple *tuple, ...@@ -60,9 +60,8 @@ static bool ipv4_invert_tuple(struct nf_conntrack_tuple *tuple,
static int ipv4_print_tuple(struct seq_file *s, static int ipv4_print_tuple(struct seq_file *s,
const struct nf_conntrack_tuple *tuple) const struct nf_conntrack_tuple *tuple)
{ {
return seq_printf(s, "src=%u.%u.%u.%u dst=%u.%u.%u.%u ", return seq_printf(s, "src=%pI4 dst=%pI4 ",
NIPQUAD(tuple->src.u3.ip), &tuple->src.u3.ip, &tuple->dst.u3.ip);
NIPQUAD(tuple->dst.u3.ip));
} }
static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
...@@ -284,17 +283,17 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len) ...@@ -284,17 +283,17 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len)
.tuple.dst.u3.ip; .tuple.dst.u3.ip;
memset(sin.sin_zero, 0, sizeof(sin.sin_zero)); memset(sin.sin_zero, 0, sizeof(sin.sin_zero));
pr_debug("SO_ORIGINAL_DST: %u.%u.%u.%u %u\n", pr_debug("SO_ORIGINAL_DST: %pI4 %u\n",
NIPQUAD(sin.sin_addr.s_addr), ntohs(sin.sin_port)); &sin.sin_addr.s_addr, ntohs(sin.sin_port));
nf_ct_put(ct); nf_ct_put(ct);
if (copy_to_user(user, &sin, sizeof(sin)) != 0) if (copy_to_user(user, &sin, sizeof(sin)) != 0)
return -EFAULT; return -EFAULT;
else else
return 0; return 0;
} }
pr_debug("SO_ORIGINAL_DST: Can't find %u.%u.%u.%u/%u-%u.%u.%u.%u/%u.\n", pr_debug("SO_ORIGINAL_DST: Can't find %pI4/%u-%pI4/%u.\n",
NIPQUAD(tuple.src.u3.ip), ntohs(tuple.src.u.tcp.port), &tuple.src.u3.ip, ntohs(tuple.src.u.tcp.port),
NIPQUAD(tuple.dst.u3.ip), ntohs(tuple.dst.u.tcp.port)); &tuple.dst.u3.ip, ntohs(tuple.dst.u.tcp.port));
return -ENOENT; return -ENOENT;
} }
......
...@@ -119,10 +119,9 @@ static int set_sig_addr(struct sk_buff *skb, struct nf_conn *ct, ...@@ -119,10 +119,9 @@ static int set_sig_addr(struct sk_buff *skb, struct nf_conn *ct,
(ntohl(addr.ip) & 0xff000000) == 0x7f000000) (ntohl(addr.ip) & 0xff000000) == 0x7f000000)
i = 0; i = 0;
pr_debug("nf_nat_ras: set signal address " pr_debug("nf_nat_ras: set signal address %pI4:%hu->%pI4:%hu\n",
"%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", &addr.ip, port,
NIPQUAD(addr.ip), port, &ct->tuplehash[!dir].tuple.dst.u3.ip,
NIPQUAD(ct->tuplehash[!dir].tuple.dst.u3.ip),
info->sig_port[!dir]); info->sig_port[!dir]);
return set_h225_addr(skb, data, 0, &taddr[i], return set_h225_addr(skb, data, 0, &taddr[i],
&ct->tuplehash[!dir]. &ct->tuplehash[!dir].
...@@ -131,10 +130,9 @@ static int set_sig_addr(struct sk_buff *skb, struct nf_conn *ct, ...@@ -131,10 +130,9 @@ static int set_sig_addr(struct sk_buff *skb, struct nf_conn *ct,
} else if (addr.ip == ct->tuplehash[dir].tuple.dst.u3.ip && } else if (addr.ip == ct->tuplehash[dir].tuple.dst.u3.ip &&
port == info->sig_port[dir]) { port == info->sig_port[dir]) {
/* GK->GW */ /* GK->GW */
pr_debug("nf_nat_ras: set signal address " pr_debug("nf_nat_ras: set signal address %pI4:%hu->%pI4:%hu\n",
"%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", &addr.ip, port,
NIPQUAD(addr.ip), port, &ct->tuplehash[!dir].tuple.src.u3.ip,
NIPQUAD(ct->tuplehash[!dir].tuple.src.u3.ip),
info->sig_port[!dir]); info->sig_port[!dir]);
return set_h225_addr(skb, data, 0, &taddr[i], return set_h225_addr(skb, data, 0, &taddr[i],
&ct->tuplehash[!dir]. &ct->tuplehash[!dir].
...@@ -162,10 +160,9 @@ static int set_ras_addr(struct sk_buff *skb, struct nf_conn *ct, ...@@ -162,10 +160,9 @@ static int set_ras_addr(struct sk_buff *skb, struct nf_conn *ct,
if (get_h225_addr(ct, *data, &taddr[i], &addr, &port) && if (get_h225_addr(ct, *data, &taddr[i], &addr, &port) &&
addr.ip == ct->tuplehash[dir].tuple.src.u3.ip && addr.ip == ct->tuplehash[dir].tuple.src.u3.ip &&
port == ct->tuplehash[dir].tuple.src.u.udp.port) { port == ct->tuplehash[dir].tuple.src.u.udp.port) {
pr_debug("nf_nat_ras: set rasAddress " pr_debug("nf_nat_ras: set rasAddress %pI4:%hu->%pI4:%hu\n",
"%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", &addr.ip, ntohs(port),
NIPQUAD(addr.ip), ntohs(port), &ct->tuplehash[!dir].tuple.dst.u3.ip,
NIPQUAD(ct->tuplehash[!dir].tuple.dst.u3.ip),
ntohs(ct->tuplehash[!dir].tuple.dst.u.udp.port)); ntohs(ct->tuplehash[!dir].tuple.dst.u.udp.port));
return set_h225_addr(skb, data, 0, &taddr[i], return set_h225_addr(skb, data, 0, &taddr[i],
&ct->tuplehash[!dir].tuple.dst.u3, &ct->tuplehash[!dir].tuple.dst.u3,
...@@ -257,15 +254,15 @@ static int nat_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct, ...@@ -257,15 +254,15 @@ static int nat_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct,
} }
/* Success */ /* Success */
pr_debug("nf_nat_h323: expect RTP %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", pr_debug("nf_nat_h323: expect RTP %pI4:%hu->%pI4:%hu\n",
NIPQUAD(rtp_exp->tuple.src.u3.ip), &rtp_exp->tuple.src.u3.ip,
ntohs(rtp_exp->tuple.src.u.udp.port), ntohs(rtp_exp->tuple.src.u.udp.port),
NIPQUAD(rtp_exp->tuple.dst.u3.ip), &rtp_exp->tuple.dst.u3.ip,
ntohs(rtp_exp->tuple.dst.u.udp.port)); ntohs(rtp_exp->tuple.dst.u.udp.port));
pr_debug("nf_nat_h323: expect RTCP %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", pr_debug("nf_nat_h323: expect RTCP %pI4:%hu->%pI4:%hu\n",
NIPQUAD(rtcp_exp->tuple.src.u3.ip), &rtcp_exp->tuple.src.u3.ip,
ntohs(rtcp_exp->tuple.src.u.udp.port), ntohs(rtcp_exp->tuple.src.u.udp.port),
NIPQUAD(rtcp_exp->tuple.dst.u3.ip), &rtcp_exp->tuple.dst.u3.ip,
ntohs(rtcp_exp->tuple.dst.u.udp.port)); ntohs(rtcp_exp->tuple.dst.u.udp.port));
return 0; return 0;
...@@ -307,10 +304,10 @@ static int nat_t120(struct sk_buff *skb, struct nf_conn *ct, ...@@ -307,10 +304,10 @@ static int nat_t120(struct sk_buff *skb, struct nf_conn *ct,
return -1; return -1;
} }
pr_debug("nf_nat_h323: expect T.120 %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", pr_debug("nf_nat_h323: expect T.120 %pI4:%hu->%pI4:%hu\n",
NIPQUAD(exp->tuple.src.u3.ip), &exp->tuple.src.u3.ip,
ntohs(exp->tuple.src.u.tcp.port), ntohs(exp->tuple.src.u.tcp.port),
NIPQUAD(exp->tuple.dst.u3.ip), &exp->tuple.dst.u3.ip,
ntohs(exp->tuple.dst.u.tcp.port)); ntohs(exp->tuple.dst.u.tcp.port));
return 0; return 0;
...@@ -361,10 +358,10 @@ static int nat_h245(struct sk_buff *skb, struct nf_conn *ct, ...@@ -361,10 +358,10 @@ static int nat_h245(struct sk_buff *skb, struct nf_conn *ct,
return -1; return -1;
} }
pr_debug("nf_nat_q931: expect H.245 %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", pr_debug("nf_nat_q931: expect H.245 %pI4:%hu->%pI4:%hu\n",
NIPQUAD(exp->tuple.src.u3.ip), &exp->tuple.src.u3.ip,
ntohs(exp->tuple.src.u.tcp.port), ntohs(exp->tuple.src.u.tcp.port),
NIPQUAD(exp->tuple.dst.u3.ip), &exp->tuple.dst.u3.ip,
ntohs(exp->tuple.dst.u.tcp.port)); ntohs(exp->tuple.dst.u.tcp.port));
return 0; return 0;
...@@ -455,10 +452,10 @@ static int nat_q931(struct sk_buff *skb, struct nf_conn *ct, ...@@ -455,10 +452,10 @@ static int nat_q931(struct sk_buff *skb, struct nf_conn *ct,
} }
/* Success */ /* Success */
pr_debug("nf_nat_ras: expect Q.931 %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", pr_debug("nf_nat_ras: expect Q.931 %pI4:%hu->%pI4:%hu\n",
NIPQUAD(exp->tuple.src.u3.ip), &exp->tuple.src.u3.ip,
ntohs(exp->tuple.src.u.tcp.port), ntohs(exp->tuple.src.u.tcp.port),
NIPQUAD(exp->tuple.dst.u3.ip), &exp->tuple.dst.u3.ip,
ntohs(exp->tuple.dst.u.tcp.port)); ntohs(exp->tuple.dst.u.tcp.port));
return 0; return 0;
...@@ -524,11 +521,10 @@ static int nat_callforwarding(struct sk_buff *skb, struct nf_conn *ct, ...@@ -524,11 +521,10 @@ static int nat_callforwarding(struct sk_buff *skb, struct nf_conn *ct,
} }
/* Success */ /* Success */
pr_debug("nf_nat_q931: expect Call Forwarding " pr_debug("nf_nat_q931: expect Call Forwarding %pI4:%hu->%pI4:%hu\n",
"%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", &exp->tuple.src.u3.ip,
NIPQUAD(exp->tuple.src.u3.ip),
ntohs(exp->tuple.src.u.tcp.port), ntohs(exp->tuple.src.u.tcp.port),
NIPQUAD(exp->tuple.dst.u3.ip), &exp->tuple.dst.u3.ip,
ntohs(exp->tuple.dst.u.tcp.port)); ntohs(exp->tuple.dst.u.tcp.port));
return 0; return 0;
......
...@@ -55,8 +55,8 @@ static unsigned int help(struct sk_buff *skb, ...@@ -55,8 +55,8 @@ static unsigned int help(struct sk_buff *skb,
ip = ntohl(exp->master->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip); ip = ntohl(exp->master->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip);
sprintf(buffer, "%u %u", ip, port); sprintf(buffer, "%u %u", ip, port);
pr_debug("nf_nat_irc: inserting '%s' == %u.%u.%u.%u, port %u\n", pr_debug("nf_nat_irc: inserting '%s' == %pI4, port %u\n",
buffer, NIPQUAD(ip), port); buffer, &ip, port);
ret = nf_nat_mangle_tcp_packet(skb, exp->master, ctinfo, ret = nf_nat_mangle_tcp_packet(skb, exp->master, ctinfo,
matchoff, matchlen, buffer, matchoff, matchlen, buffer,
......
...@@ -98,8 +98,7 @@ static void warn_if_extra_mangle(struct net *net, __be32 dstip, __be32 srcip) ...@@ -98,8 +98,7 @@ static void warn_if_extra_mangle(struct net *net, __be32 dstip, __be32 srcip)
if (rt->rt_src != srcip && !warned) { if (rt->rt_src != srcip && !warned) {
printk("NAT: no longer support implicit source local NAT\n"); printk("NAT: no longer support implicit source local NAT\n");
printk("NAT: packet src %u.%u.%u.%u -> dst %u.%u.%u.%u\n", printk("NAT: packet src %pI4 -> dst %pI4\n", &srcip, &dstip);
NIPQUAD(srcip), NIPQUAD(dstip));
warned = 1; warned = 1;
} }
ip_rt_put(rt); ip_rt_put(rt);
...@@ -166,8 +165,7 @@ alloc_null_binding(struct nf_conn *ct, unsigned int hooknum) ...@@ -166,8 +165,7 @@ alloc_null_binding(struct nf_conn *ct, unsigned int hooknum)
struct nf_nat_range range struct nf_nat_range range
= { IP_NAT_RANGE_MAP_IPS, ip, ip, { 0 }, { 0 } }; = { IP_NAT_RANGE_MAP_IPS, ip, ip, { 0 }, { 0 } };
pr_debug("Allocating NULL binding for %p (%u.%u.%u.%u)\n", pr_debug("Allocating NULL binding for %p (%pI4)\n", ct, &ip);
ct, NIPQUAD(ip));
return nf_nat_setup_info(ct, &range, HOOK2MANIP(hooknum)); return nf_nat_setup_info(ct, &range, HOOK2MANIP(hooknum));
} }
......
...@@ -74,8 +74,7 @@ static int map_addr(struct sk_buff *skb, ...@@ -74,8 +74,7 @@ static int map_addr(struct sk_buff *skb,
if (newaddr == addr->ip && newport == port) if (newaddr == addr->ip && newport == port)
return 1; return 1;
buflen = sprintf(buffer, "%u.%u.%u.%u:%u", buflen = sprintf(buffer, "%pI4:%u", &newaddr, ntohs(newport));
NIPQUAD(newaddr), ntohs(newport));
return mangle_packet(skb, dptr, datalen, matchoff, matchlen, return mangle_packet(skb, dptr, datalen, matchoff, matchlen,
buffer, buflen); buffer, buflen);
...@@ -152,8 +151,8 @@ static unsigned int ip_nat_sip(struct sk_buff *skb, ...@@ -152,8 +151,8 @@ static unsigned int ip_nat_sip(struct sk_buff *skb,
&addr) > 0 && &addr) > 0 &&
addr.ip == ct->tuplehash[dir].tuple.src.u3.ip && addr.ip == ct->tuplehash[dir].tuple.src.u3.ip &&
addr.ip != ct->tuplehash[!dir].tuple.dst.u3.ip) { addr.ip != ct->tuplehash[!dir].tuple.dst.u3.ip) {
__be32 ip = ct->tuplehash[!dir].tuple.dst.u3.ip; buflen = sprintf(buffer, "%pI4",
buflen = sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip)); &ct->tuplehash[!dir].tuple.dst.u3.ip);
if (!mangle_packet(skb, dptr, datalen, poff, plen, if (!mangle_packet(skb, dptr, datalen, poff, plen,
buffer, buflen)) buffer, buflen))
return NF_DROP; return NF_DROP;
...@@ -166,8 +165,8 @@ static unsigned int ip_nat_sip(struct sk_buff *skb, ...@@ -166,8 +165,8 @@ static unsigned int ip_nat_sip(struct sk_buff *skb,
&addr) > 0 && &addr) > 0 &&
addr.ip == ct->tuplehash[dir].tuple.dst.u3.ip && addr.ip == ct->tuplehash[dir].tuple.dst.u3.ip &&
addr.ip != ct->tuplehash[!dir].tuple.src.u3.ip) { addr.ip != ct->tuplehash[!dir].tuple.src.u3.ip) {
__be32 ip = ct->tuplehash[!dir].tuple.src.u3.ip; buflen = sprintf(buffer, "%pI4",
buflen = sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip)); &ct->tuplehash[!dir].tuple.src.u3.ip);
if (!mangle_packet(skb, dptr, datalen, poff, plen, if (!mangle_packet(skb, dptr, datalen, poff, plen,
buffer, buflen)) buffer, buflen))
return NF_DROP; return NF_DROP;
...@@ -279,8 +278,7 @@ static unsigned int ip_nat_sip_expect(struct sk_buff *skb, ...@@ -279,8 +278,7 @@ static unsigned int ip_nat_sip_expect(struct sk_buff *skb,
if (exp->tuple.dst.u3.ip != exp->saved_ip || if (exp->tuple.dst.u3.ip != exp->saved_ip ||
exp->tuple.dst.u.udp.port != exp->saved_proto.udp.port) { exp->tuple.dst.u.udp.port != exp->saved_proto.udp.port) {
buflen = sprintf(buffer, "%u.%u.%u.%u:%u", buflen = sprintf(buffer, "%pI4:%u", &newip, port);
NIPQUAD(newip), port);
if (!mangle_packet(skb, dptr, datalen, matchoff, matchlen, if (!mangle_packet(skb, dptr, datalen, matchoff, matchlen,
buffer, buflen)) buffer, buflen))
goto err; goto err;
...@@ -345,7 +343,7 @@ static unsigned int ip_nat_sdp_addr(struct sk_buff *skb, const char **dptr, ...@@ -345,7 +343,7 @@ static unsigned int ip_nat_sdp_addr(struct sk_buff *skb, const char **dptr,
char buffer[sizeof("nnn.nnn.nnn.nnn")]; char buffer[sizeof("nnn.nnn.nnn.nnn")];
unsigned int buflen; unsigned int buflen;
buflen = sprintf(buffer, NIPQUAD_FMT, NIPQUAD(addr->ip)); buflen = sprintf(buffer, "%pI4", &addr->ip);
if (mangle_sdp_packet(skb, dptr, dataoff, datalen, type, term, if (mangle_sdp_packet(skb, dptr, dataoff, datalen, type, term,
buffer, buflen)) buffer, buflen))
return 0; return 0;
...@@ -380,7 +378,7 @@ static unsigned int ip_nat_sdp_session(struct sk_buff *skb, const char **dptr, ...@@ -380,7 +378,7 @@ static unsigned int ip_nat_sdp_session(struct sk_buff *skb, const char **dptr,
unsigned int buflen; unsigned int buflen;
/* Mangle session description owner and contact addresses */ /* Mangle session description owner and contact addresses */
buflen = sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(addr->ip)); buflen = sprintf(buffer, "%pI4", &addr->ip);
if (mangle_sdp_packet(skb, dptr, dataoff, datalen, if (mangle_sdp_packet(skb, dptr, dataoff, datalen,
SDP_HDR_OWNER_IP4, SDP_HDR_MEDIA, SDP_HDR_OWNER_IP4, SDP_HDR_MEDIA,
buffer, buflen)) buffer, buflen))
......
...@@ -930,8 +930,8 @@ static inline void mangle_address(unsigned char *begin, ...@@ -930,8 +930,8 @@ static inline void mangle_address(unsigned char *begin,
} }
if (debug) if (debug)
printk(KERN_DEBUG "bsalg: mapped %u.%u.%u.%u to " printk(KERN_DEBUG "bsalg: mapped %pI4 to %pI4\n",
"%u.%u.%u.%u\n", NIPQUAD(old), NIPQUAD(*addr)); &old, addr);
} }
} }
...@@ -1267,9 +1267,8 @@ static int help(struct sk_buff *skb, unsigned int protoff, ...@@ -1267,9 +1267,8 @@ static int help(struct sk_buff *skb, unsigned int protoff,
*/ */
if (ntohs(udph->len) != skb->len - (iph->ihl << 2)) { if (ntohs(udph->len) != skb->len - (iph->ihl << 2)) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING "SNMP: dropping malformed packet " printk(KERN_WARNING "SNMP: dropping malformed packet src=%pI4 dst=%pI4\n",
"src=%u.%u.%u.%u dst=%u.%u.%u.%u\n", &iph->saddr, &iph->daddr);
NIPQUAD(iph->saddr), NIPQUAD(iph->daddr));
return NF_DROP; return NF_DROP;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment