Skip to content

Commit

Permalink
net: replace NIPQUAD() in net/*/
Browse files Browse the repository at this point in the history
Using NIPQUAD() with NIPQUAD_FMT, %d.%d.%d.%d or %u.%u.%u.%u
can be replaced with %pI4

Signed-off-by: Harvey Harrison <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
hharrison authored and davem330 committed Oct 31, 2008
1 parent 14d5e83 commit 21454aa
Show file tree
Hide file tree
Showing 26 changed files with 127 additions and 150 deletions.
4 changes: 2 additions & 2 deletions net/atm/clip.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,8 @@ static void atmarp_info(struct seq_file *seq, struct net_device *dev,
seq_printf(seq, "%-6s%-4s%-4s%5ld ",
dev->name, svc ? "SVC" : "PVC", llc ? "LLC" : "NULL", exp);

off = scnprintf(buf, sizeof(buf) - 1, "%d.%d.%d.%d",
NIPQUAD(entry->ip));
off = scnprintf(buf, sizeof(buf) - 1, "%pI4",
&entry->ip);
while (off < 16)
buf[off++] = ' ';
buf[off] = '\0';
Expand Down
26 changes: 14 additions & 12 deletions net/atm/mpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ void atm_mpoa_disp_qos(struct seq_file *m)
seq_printf(m, "IP address\n TX:max_pcr pcr min_pcr max_cdv max_sdu\n RX:max_pcr pcr min_pcr max_cdv max_sdu\n");

while (qos != NULL) {
seq_printf(m, "%u.%u.%u.%u\n %-7d %-7d %-7d %-7d %-7d\n %-7d %-7d %-7d %-7d %-7d\n",
NIPQUAD(qos->ipaddr),
seq_printf(m, "%pI4\n %-7d %-7d %-7d %-7d %-7d\n %-7d %-7d %-7d %-7d %-7d\n",
&qos->ipaddr,
qos->qos.txtp.max_pcr, qos->qos.txtp.pcr, qos->qos.txtp.min_pcr, qos->qos.txtp.max_cdv, qos->qos.txtp.max_sdu,
qos->qos.rxtp.max_pcr, qos->qos.rxtp.pcr, qos->qos.rxtp.min_pcr, qos->qos.rxtp.max_cdv, qos->qos.rxtp.max_sdu);
qos = qos->next;
Expand Down Expand Up @@ -595,8 +595,8 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg)
if (in_entry != NULL) mpc->in_ops->put(in_entry);
return -EINVAL;
}
printk("mpoa: (%s) mpc_vcc_attach: attaching ingress SVC, entry = %u.%u.%u.%u\n",
mpc->dev->name, NIPQUAD(in_entry->ctrl_info.in_dst_ip));
printk("mpoa: (%s) mpc_vcc_attach: attaching ingress SVC, entry = %pI4\n",
mpc->dev->name, &in_entry->ctrl_info.in_dst_ip);
in_entry->shortcut = vcc;
mpc->in_ops->put(in_entry);
} else {
Expand Down Expand Up @@ -627,8 +627,8 @@ static void mpc_vcc_close(struct atm_vcc *vcc, struct net_device *dev)
dprintk("mpoa: (%s) mpc_vcc_close:\n", dev->name);
in_entry = mpc->in_ops->get_by_vcc(vcc, mpc);
if (in_entry) {
dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %u.%u.%u.%u\n",
mpc->dev->name, NIPQUAD(in_entry->ctrl_info.in_dst_ip));
dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %pI4\n",
mpc->dev->name, &in_entry->ctrl_info.in_dst_ip);
in_entry->shortcut = NULL;
mpc->in_ops->put(in_entry);
}
Expand Down Expand Up @@ -1098,7 +1098,8 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien
entry->shortcut = eg_entry->shortcut;
}
if(entry->shortcut){
dprintk("mpoa: (%s) using egress SVC to reach %u.%u.%u.%u\n",client->dev->name, NIPQUAD(dst_ip));
dprintk("mpoa: (%s) using egress SVC to reach %pI4\n",
client->dev->name, &dst_ip);
client->eg_ops->put(eg_entry);
return;
}
Expand All @@ -1123,7 +1124,8 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc)
__be32 dst_ip = msg->content.in_info.in_dst_ip;
in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc);

dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %u.%u.%u.%u\n", mpc->dev->name, NIPQUAD(dst_ip));
dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %pI4\n",
mpc->dev->name, &dst_ip);
ddprintk("mpoa: (%s) MPOA_res_reply_rcvd() entry = %p", mpc->dev->name, entry);
if(entry == NULL){
printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name);
Expand Down Expand Up @@ -1171,14 +1173,14 @@ static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc)
in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask);

if(entry == NULL){
printk("mpoa: (%s) ingress_purge_rcvd: purge for a non-existing entry, ", mpc->dev->name);
printk("ip = %u.%u.%u.%u\n", NIPQUAD(dst_ip));
printk("mpoa: (%s) ingress_purge_rcvd: purge for a non-existing entry, ip = %pI4\n",
mpc->dev->name, &dst_ip);
return;
}

do {
dprintk("mpoa: (%s) ingress_purge_rcvd: removing an ingress entry, ip = %u.%u.%u.%u\n" ,
mpc->dev->name, NIPQUAD(dst_ip));
dprintk("mpoa: (%s) ingress_purge_rcvd: removing an ingress entry, ip = %pI4\n",
mpc->dev->name, &dst_ip);
write_lock_bh(&mpc->ingress_lock);
mpc->in_ops->remove_entry(entry, mpc);
write_unlock_bh(&mpc->ingress_lock);
Expand Down
18 changes: 11 additions & 7 deletions net/atm/mpoa_caches.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static in_cache_entry *in_cache_add_entry(__be32 dst_ip,
return NULL;
}

dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %u.%u.%u.%u\n", NIPQUAD(dst_ip));
dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %pI4\n", &dst_ip);

atomic_set(&entry->use, 1);
dprintk("mpoa: mpoa_caches.c: new_in_cache_entry: about to lock\n");
Expand Down Expand Up @@ -150,7 +150,8 @@ static int cache_hit(in_cache_entry *entry, struct mpoa_client *mpc)

if( entry->count > mpc->parameters.mpc_p1 &&
entry->entry_state == INGRESS_INVALID){
dprintk("mpoa: (%s) mpoa_caches.c: threshold exceeded for ip %u.%u.%u.%u, sending MPOA res req\n", mpc->dev->name, NIPQUAD(entry->ctrl_info.in_dst_ip));
dprintk("mpoa: (%s) mpoa_caches.c: threshold exceeded for ip %pI4, sending MPOA res req\n",
mpc->dev->name, &entry->ctrl_info.in_dst_ip);
entry->entry_state = INGRESS_RESOLVING;
msg.type = SND_MPOA_RES_RQST;
memcpy(msg.MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN );
Expand Down Expand Up @@ -184,7 +185,8 @@ static void in_cache_remove_entry(in_cache_entry *entry,
struct k_message msg;

vcc = entry->shortcut;
dprintk("mpoa: mpoa_caches.c: removing an ingress entry, ip = %u.%u.%u.%u\n",NIPQUAD(entry->ctrl_info.in_dst_ip));
dprintk("mpoa: mpoa_caches.c: removing an ingress entry, ip = %pI4\n",
&entry->ctrl_info.in_dst_ip);

if (entry->prev != NULL)
entry->prev->next = entry->next;
Expand Down Expand Up @@ -228,7 +230,8 @@ static void clear_count_and_expired(struct mpoa_client *client)
next_entry = entry->next;
if((now.tv_sec - entry->tv.tv_sec)
> entry->ctrl_info.holding_time){
dprintk("mpoa: mpoa_caches.c: holding time expired, ip = %u.%u.%u.%u\n", NIPQUAD(entry->ctrl_info.in_dst_ip));
dprintk("mpoa: mpoa_caches.c: holding time expired, ip = %pI4\n",
&entry->ctrl_info.in_dst_ip);
client->in_ops->remove_entry(entry, client);
}
entry = next_entry;
Expand Down Expand Up @@ -453,7 +456,8 @@ static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_cli
return NULL;
}

dprintk("mpoa: mpoa_caches.c: adding an egress entry, ip = %u.%u.%u.%u, this should be our IP\n", NIPQUAD(msg->content.eg_info.eg_dst_ip));
dprintk("mpoa: mpoa_caches.c: adding an egress entry, ip = %pI4, this should be our IP\n",
&msg->content.eg_info.eg_dst_ip);

atomic_set(&entry->use, 1);
dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry: about to lock\n");
Expand All @@ -469,8 +473,8 @@ static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_cli
do_gettimeofday(&(entry->tv));
entry->entry_state = EGRESS_RESOLVED;
dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry cache_id %lu\n", ntohl(entry->ctrl_info.cache_id));
dprintk("mpoa: mpoa_caches.c: mps_ip = %u.%u.%u.%u\n",
NIPQUAD(entry->ctrl_info.mps_ip));
dprintk("mpoa: mpoa_caches.c: mps_ip = %pI4\n",
&entry->ctrl_info.mps_ip);
atomic_inc(&entry->use);

write_unlock_irq(&client->egress_lock);
Expand Down
12 changes: 4 additions & 8 deletions net/bridge/netfilter/ebt_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ print_ports(const struct sk_buff *skb, uint8_t protocol, int offset)
}
}

#define myNIPQUAD(a) a[0], a[1], a[2], a[3]
static void
ebt_log_packet(u_int8_t pf, unsigned int hooknum,
const struct sk_buff *skb, const struct net_device *in,
Expand Down Expand Up @@ -113,9 +112,8 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum,
printk(" INCOMPLETE IP header");
goto out;
}
printk(" IP SRC=%u.%u.%u.%u IP DST=%u.%u.%u.%u, IP "
"tos=0x%02X, IP proto=%d", NIPQUAD(ih->saddr),
NIPQUAD(ih->daddr), ih->tos, ih->protocol);
printk(" IP SRC=%pI4 IP DST=%pI4, IP tos=0x%02X, IP proto=%d",
&ih->saddr, &ih->daddr, ih->tos, ih->protocol);
print_ports(skb, ih->protocol, ih->ihl*4);
goto out;
}
Expand Down Expand Up @@ -175,12 +173,10 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum,
}
printk(" ARP MAC SRC=");
print_MAC(ap->mac_src);
printk(" ARP IP SRC=%u.%u.%u.%u",
myNIPQUAD(ap->ip_src));
printk(" ARP IP SRC=%pI4", ap->ip_src);
printk(" ARP MAC DST=");
print_MAC(ap->mac_dst);
printk(" ARP IP DST=%u.%u.%u.%u",
myNIPQUAD(ap->ip_dst));
printk(" ARP IP DST=%pI4", ap->ip_dst);
}
}
out:
Expand Down
8 changes: 3 additions & 5 deletions net/dccp/ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -792,12 +792,10 @@ static int dccp_v4_rcv(struct sk_buff *skb)
DCCP_SKB_CB(skb)->dccpd_seq = dccp_hdr_seq(dh);
DCCP_SKB_CB(skb)->dccpd_type = dh->dccph_type;

dccp_pr_debug("%8.8s "
"src=%u.%u.%u.%u@%-5d "
"dst=%u.%u.%u.%u@%-5d seq=%llu",
dccp_pr_debug("%8.8s src=%pI4@%-5d dst=%pI4@%-5d seq=%llu",
dccp_packet_name(dh->dccph_type),
NIPQUAD(iph->saddr), ntohs(dh->dccph_sport),
NIPQUAD(iph->daddr), ntohs(dh->dccph_dport),
&iph->saddr, ntohs(dh->dccph_sport),
&iph->daddr, ntohs(dh->dccph_dport),
(unsigned long long) DCCP_SKB_CB(skb)->dccpd_seq);

if (dccp_packet_without_ack(skb)) {
Expand Down
12 changes: 6 additions & 6 deletions net/dccp/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,18 @@ static int jdccp_sendmsg(struct kiocb *iocb, struct sock *sk,
if (port == 0 || ntohs(inet->dport) == port ||
ntohs(inet->sport) == port) {
if (hctx)
printl("%d.%d.%d.%d:%u %d.%d.%d.%d:%u %d %d %d %d %u "
printl("%pI4:%u %pI4:%u %d %d %d %d %u "
"%llu %llu %d\n",
NIPQUAD(inet->saddr), ntohs(inet->sport),
NIPQUAD(inet->daddr), ntohs(inet->dport), size,
&inet->saddr, ntohs(inet->sport),
&inet->daddr, ntohs(inet->dport), size,
hctx->ccid3hctx_s, hctx->ccid3hctx_rtt,
hctx->ccid3hctx_p, hctx->ccid3hctx_x_calc,
hctx->ccid3hctx_x_recv >> 6,
hctx->ccid3hctx_x >> 6, hctx->ccid3hctx_t_ipi);
else
printl("%d.%d.%d.%d:%u %d.%d.%d.%d:%u %d\n",
NIPQUAD(inet->saddr), ntohs(inet->sport),
NIPQUAD(inet->daddr), ntohs(inet->dport), size);
printl("%pI4:%u %pI4:%u %d\n",
&inet->saddr, ntohs(inet->sport),
&inet->daddr, ntohs(inet->dport), size);
}

jprobe_return();
Expand Down
2 changes: 1 addition & 1 deletion net/netlabel/netlabel_addrlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void netlbl_af4list_audit_addr(struct audit_buffer *audit_buf,

if (dev != NULL)
audit_log_format(audit_buf, " netif=%s", dev);
audit_log_format(audit_buf, " %s=" NIPQUAD_FMT, dir, NIPQUAD(addr));
audit_log_format(audit_buf, " %s=%pI4", dir, &addr);
if (mask_val != 0xffffffff) {
u32 mask_len = 0;
while (mask_val > 0) {
Expand Down
4 changes: 2 additions & 2 deletions net/rxrpc/af_rxrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ static int rxrpc_validate_address(struct rxrpc_sock *rx,

switch (srx->transport.family) {
case AF_INET:
_debug("INET: %x @ %u.%u.%u.%u",
_debug("INET: %x @ %pI4",
ntohs(srx->transport.sin.sin_port),
NIPQUAD(srx->transport.sin.sin_addr));
&srx->transport.sin.sin_addr);
if (srx->transport_len > 8)
memset((void *)&srx->transport + 8, 0,
srx->transport_len - 8);
Expand Down
3 changes: 1 addition & 2 deletions net/rxrpc/ar-error.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ void rxrpc_UDP_error_report(struct sock *sk)
addr = *(__be32 *)(skb_network_header(skb) + serr->addr_offset);
port = serr->port;

_net("Rx UDP Error from "NIPQUAD_FMT":%hu",
NIPQUAD(addr), ntohs(port));
_net("Rx UDP Error from %pI4:%hu", &addr, ntohs(port));
_debug("Msg l:%d d:%d", skb->len, skb->data_len);

peer = rxrpc_find_peer(local, addr, port);
Expand Down
16 changes: 8 additions & 8 deletions net/rxrpc/ar-local.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ struct rxrpc_local *rxrpc_lookup_local(struct sockaddr_rxrpc *srx)
struct rxrpc_local *local;
int ret;

_enter("{%d,%u,%u.%u.%u.%u+%hu}",
_enter("{%d,%u,%pI4+%hu}",
srx->transport_type,
srx->transport.family,
NIPQUAD(srx->transport.sin.sin_addr),
&srx->transport.sin.sin_addr,
ntohs(srx->transport.sin.sin_port));

down_write(&rxrpc_local_sem);
Expand All @@ -143,10 +143,10 @@ struct rxrpc_local *rxrpc_lookup_local(struct sockaddr_rxrpc *srx)
read_lock_bh(&rxrpc_local_lock);

list_for_each_entry(local, &rxrpc_locals, link) {
_debug("CMP {%d,%u,%u.%u.%u.%u+%hu}",
_debug("CMP {%d,%u,%pI4+%hu}",
local->srx.transport_type,
local->srx.transport.family,
NIPQUAD(local->srx.transport.sin.sin_addr),
&local->srx.transport.sin.sin_addr,
ntohs(local->srx.transport.sin.sin_port));

if (local->srx.transport_type != srx->transport_type ||
Expand Down Expand Up @@ -188,11 +188,11 @@ struct rxrpc_local *rxrpc_lookup_local(struct sockaddr_rxrpc *srx)

up_write(&rxrpc_local_sem);

_net("LOCAL new %d {%d,%u,%u.%u.%u.%u+%hu}",
_net("LOCAL new %d {%d,%u,%pI4+%hu}",
local->debug_id,
local->srx.transport_type,
local->srx.transport.family,
NIPQUAD(local->srx.transport.sin.sin_addr),
&local->srx.transport.sin.sin_addr,
ntohs(local->srx.transport.sin.sin_port));

_leave(" = %p [new]", local);
Expand All @@ -203,11 +203,11 @@ struct rxrpc_local *rxrpc_lookup_local(struct sockaddr_rxrpc *srx)
read_unlock_bh(&rxrpc_local_lock);
up_write(&rxrpc_local_sem);

_net("LOCAL old %d {%d,%u,%u.%u.%u.%u+%hu}",
_net("LOCAL old %d {%d,%u,%pI4+%hu}",
local->debug_id,
local->srx.transport_type,
local->srx.transport.family,
NIPQUAD(local->srx.transport.sin.sin_addr),
&local->srx.transport.sin.sin_addr,
ntohs(local->srx.transport.sin.sin_port));

_leave(" = %p [reuse]", local);
Expand Down
8 changes: 4 additions & 4 deletions net/rxrpc/ar-peer.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ struct rxrpc_peer *rxrpc_get_peer(struct sockaddr_rxrpc *srx, gfp_t gfp)
const char *new = "old";
int usage;

_enter("{%d,%d,%u.%u.%u.%u+%hu}",
_enter("{%d,%d,%pI4+%hu}",
srx->transport_type,
srx->transport_len,
NIPQUAD(srx->transport.sin.sin_addr),
&srx->transport.sin.sin_addr,
ntohs(srx->transport.sin.sin_port));

/* search the peer list first */
Expand Down Expand Up @@ -177,12 +177,12 @@ struct rxrpc_peer *rxrpc_get_peer(struct sockaddr_rxrpc *srx, gfp_t gfp)
new = "new";

success:
_net("PEER %s %d {%d,%u,%u.%u.%u.%u+%hu}",
_net("PEER %s %d {%d,%u,%pI4+%hu}",
new,
peer->debug_id,
peer->srx.transport_type,
peer->srx.transport.family,
NIPQUAD(peer->srx.transport.sin.sin_addr),
&peer->srx.transport.sin.sin_addr,
ntohs(peer->srx.transport.sin.sin_port));

_leave(" = %p {u=%d}", peer, atomic_read(&peer->usage));
Expand Down
16 changes: 8 additions & 8 deletions net/rxrpc/ar-proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v)
call = list_entry(v, struct rxrpc_call, link);
trans = call->conn->trans;

sprintf(lbuff, NIPQUAD_FMT":%u",
NIPQUAD(trans->local->srx.transport.sin.sin_addr),
sprintf(lbuff, "%pI4:%u",
&trans->local->srx.transport.sin.sin_addr,
ntohs(trans->local->srx.transport.sin.sin_port));

sprintf(rbuff, NIPQUAD_FMT":%u",
NIPQUAD(trans->peer->srx.transport.sin.sin_addr),
sprintf(rbuff, "%pI4:%u",
&trans->peer->srx.transport.sin.sin_addr,
ntohs(trans->peer->srx.transport.sin.sin_port));

seq_printf(seq,
Expand Down Expand Up @@ -144,12 +144,12 @@ static int rxrpc_connection_seq_show(struct seq_file *seq, void *v)
conn = list_entry(v, struct rxrpc_connection, link);
trans = conn->trans;

sprintf(lbuff, NIPQUAD_FMT":%u",
NIPQUAD(trans->local->srx.transport.sin.sin_addr),
sprintf(lbuff, "%pI4:%u",
&trans->local->srx.transport.sin.sin_addr,
ntohs(trans->local->srx.transport.sin.sin_port));

sprintf(rbuff, NIPQUAD_FMT":%u",
NIPQUAD(trans->peer->srx.transport.sin.sin_addr),
sprintf(rbuff, "%pI4:%u",
&trans->peer->srx.transport.sin.sin_addr,
ntohs(trans->peer->srx.transport.sin.sin_port));

seq_printf(seq,
Expand Down
12 changes: 6 additions & 6 deletions net/rxrpc/ar-transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ struct rxrpc_transport *rxrpc_get_transport(struct rxrpc_local *local,
const char *new = "old";
int usage;

_enter("{%u.%u.%u.%u+%hu},{%u.%u.%u.%u+%hu},",
NIPQUAD(local->srx.transport.sin.sin_addr),
_enter("{%pI4+%hu},{%pI4+%hu},",
&local->srx.transport.sin.sin_addr,
ntohs(local->srx.transport.sin.sin_port),
NIPQUAD(peer->srx.transport.sin.sin_addr),
&peer->srx.transport.sin.sin_addr,
ntohs(peer->srx.transport.sin.sin_port));

/* search the transport list first */
Expand Down Expand Up @@ -149,10 +149,10 @@ struct rxrpc_transport *rxrpc_find_transport(struct rxrpc_local *local,
{
struct rxrpc_transport *trans;

_enter("{%u.%u.%u.%u+%hu},{%u.%u.%u.%u+%hu},",
NIPQUAD(local->srx.transport.sin.sin_addr),
_enter("{%pI4+%hu},{%pI4+%hu},",
&local->srx.transport.sin.sin_addr,
ntohs(local->srx.transport.sin.sin_port),
NIPQUAD(peer->srx.transport.sin.sin_addr),
&peer->srx.transport.sin.sin_addr,
ntohs(peer->srx.transport.sin.sin_port));

/* search the transport list */
Expand Down
Loading

0 comments on commit 21454aa

Please sign in to comment.