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

drivers: replace NIPQUAD()

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 21454aaa
...@@ -284,8 +284,7 @@ static ssize_t sprintf_ipaddr(char *buf, u8 *ip) ...@@ -284,8 +284,7 @@ static ssize_t sprintf_ipaddr(char *buf, u8 *ip)
/* /*
* IPV4 * IPV4
*/ */
str += sprintf(buf, NIPQUAD_FMT, ip[12], str += sprintf(buf, "%pI4", ip + 12);
ip[13], ip[14], ip[15]);
} else { } else {
/* /*
* IPv6 * IPv6
......
...@@ -823,8 +823,8 @@ static struct nes_cm_node *find_node(struct nes_cm_core *cm_core, ...@@ -823,8 +823,8 @@ static struct nes_cm_node *find_node(struct nes_cm_core *cm_core,
/* get a handle on the hte */ /* get a handle on the hte */
hte = &cm_core->connected_nodes; hte = &cm_core->connected_nodes;
nes_debug(NES_DBG_CM, "Searching for an owner node: " NIPQUAD_FMT ":%x from core %p->%p\n", nes_debug(NES_DBG_CM, "Searching for an owner node: %pI4:%x from core %p->%p\n",
HIPQUAD(loc_addr), loc_port, cm_core, hte); &loc_addr, loc_port, cm_core, hte);
/* walk list and find cm_node associated with this session ID */ /* walk list and find cm_node associated with this session ID */
spin_lock_irqsave(&cm_core->ht_lock, flags); spin_lock_irqsave(&cm_core->ht_lock, flags);
...@@ -873,8 +873,8 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core, ...@@ -873,8 +873,8 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core,
} }
spin_unlock_irqrestore(&cm_core->listen_list_lock, flags); spin_unlock_irqrestore(&cm_core->listen_list_lock, flags);
nes_debug(NES_DBG_CM, "Unable to find listener for " NIPQUAD_FMT ":%x\n", nes_debug(NES_DBG_CM, "Unable to find listener for %pI4:%x\n",
HIPQUAD(dst_addr), dst_port); &dst_addr, dst_port);
/* no listener */ /* no listener */
return NULL; return NULL;
...@@ -1082,10 +1082,9 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core, ...@@ -1082,10 +1082,9 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core,
cm_node->loc_port = cm_info->loc_port; cm_node->loc_port = cm_info->loc_port;
cm_node->rem_port = cm_info->rem_port; cm_node->rem_port = cm_info->rem_port;
cm_node->send_write0 = send_first; cm_node->send_write0 = send_first;
nes_debug(NES_DBG_CM, "Make node addresses : loc = " NIPQUAD_FMT nes_debug(NES_DBG_CM, "Make node addresses : loc = %pI4:%x, rem = %pI4:%x\n",
":%x, rem = " NIPQUAD_FMT ":%x\n", &cm_node->loc_addr, cm_node->loc_port,
HIPQUAD(cm_node->loc_addr), cm_node->loc_port, &cm_node->rem_addr, cm_node->rem_port);
HIPQUAD(cm_node->rem_addr), cm_node->rem_port);
cm_node->listener = listener; cm_node->listener = listener;
cm_node->netdev = nesvnic->netdev; cm_node->netdev = nesvnic->netdev;
cm_node->cm_id = cm_info->cm_id; cm_node->cm_id = cm_info->cm_id;
...@@ -2066,10 +2065,8 @@ static void mini_cm_recv_pkt(struct nes_cm_core *cm_core, ...@@ -2066,10 +2065,8 @@ static void mini_cm_recv_pkt(struct nes_cm_core *cm_core,
nfo.rem_addr = ntohl(iph->saddr); nfo.rem_addr = ntohl(iph->saddr);
nfo.rem_port = ntohs(tcph->source); nfo.rem_port = ntohs(tcph->source);
nes_debug(NES_DBG_CM, "Received packet: dest=" NIPQUAD_FMT nes_debug(NES_DBG_CM, "Received packet: dest=%pI4:0x%04X src=%pI4:0x%04X\n",
":0x%04X src=" NIPQUAD_FMT ":0x%04X\n", &iph->daddr, tcph->dest, &iph->saddr, tcph->source);
NIPQUAD(iph->daddr), tcph->dest,
NIPQUAD(iph->saddr), tcph->source);
do { do {
cm_node = find_node(cm_core, cm_node = find_node(cm_core,
......
...@@ -679,9 +679,8 @@ int nes_arp_table(struct nes_device *nesdev, u32 ip_addr, u8 *mac_addr, u32 acti ...@@ -679,9 +679,8 @@ int nes_arp_table(struct nes_device *nesdev, u32 ip_addr, u8 *mac_addr, u32 acti
/* DELETE or RESOLVE */ /* DELETE or RESOLVE */
if (arp_index == nesadapter->arp_table_size) { if (arp_index == nesadapter->arp_table_size) {
nes_debug(NES_DBG_NETDEV, "MAC for " NIPQUAD_FMT " not in ARP table - cannot %s\n", nes_debug(NES_DBG_NETDEV, "MAC for %pI4 not in ARP table - cannot %s\n",
HIPQUAD(ip_addr), &ip_addr, action == NES_ARP_RESOLVE ? "resolve" : "delete");
action == NES_ARP_RESOLVE ? "resolve" : "delete");
return -1; return -1;
} }
......
...@@ -515,14 +515,14 @@ int iser_connect(struct iser_conn *ib_conn, ...@@ -515,14 +515,14 @@ int iser_connect(struct iser_conn *ib_conn,
struct sockaddr *src, *dst; struct sockaddr *src, *dst;
int err = 0; int err = 0;
sprintf(ib_conn->name,"%d.%d.%d.%d:%d", sprintf(ib_conn->name, "%pI4:%d",
NIPQUAD(dst_addr->sin_addr.s_addr), dst_addr->sin_port); &dst_addr->sin_addr.s_addr, dst_addr->sin_port);
/* the device is known only --after-- address resolution */ /* the device is known only --after-- address resolution */
ib_conn->device = NULL; ib_conn->device = NULL;
iser_err("connecting to: %d.%d.%d.%d, port 0x%x\n", iser_err("connecting to: %pI4, port 0x%x\n",
NIPQUAD(dst_addr->sin_addr), dst_addr->sin_port); &dst_addr->sin_addr, dst_addr->sin_port);
ib_conn->state = ISER_CONN_PENDING; ib_conn->state = ISER_CONN_PENDING;
......
...@@ -2585,8 +2585,8 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) ...@@ -2585,8 +2585,8 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
if (rv) { if (rv) {
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_WARNING DRV_NAME printk(KERN_WARNING DRV_NAME
": %s: no route to arp_ip_target %u.%u.%u.%u\n", ": %s: no route to arp_ip_target %pI4\n",
bond->dev->name, NIPQUAD(fl.fl4_dst)); bond->dev->name, &fl.fl4_dst);
} }
continue; continue;
} }
...@@ -2622,8 +2622,8 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) ...@@ -2622,8 +2622,8 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_WARNING DRV_NAME printk(KERN_WARNING DRV_NAME
": %s: no path to arp_ip_target %u.%u.%u.%u via rt.dev %s\n", ": %s: no path to arp_ip_target %pI4 via rt.dev %s\n",
bond->dev->name, NIPQUAD(fl.fl4_dst), bond->dev->name, &fl.fl4_dst,
rt->u.dst.dev ? rt->u.dst.dev->name : "NULL"); rt->u.dst.dev ? rt->u.dst.dev->name : "NULL");
} }
ip_rt_put(rt); ip_rt_put(rt);
...@@ -2672,10 +2672,8 @@ static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 ...@@ -2672,10 +2672,8 @@ static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32
targets = bond->params.arp_targets; targets = bond->params.arp_targets;
for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) { for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) {
dprintk("bva: sip %u.%u.%u.%u tip %u.%u.%u.%u t[%d] " dprintk("bva: sip %pI4 tip %pI4 t[%d] %pI4 bhti(tip) %d\n",
"%u.%u.%u.%u bhti(tip) %d\n", &sip, &tip, i, &targets[i], bond_has_this_ip(bond, tip));
NIPQUAD(sip), NIPQUAD(tip), i, NIPQUAD(targets[i]),
bond_has_this_ip(bond, tip));
if (sip == targets[i]) { if (sip == targets[i]) {
if (bond_has_this_ip(bond, tip)) if (bond_has_this_ip(bond, tip))
slave->last_arp_rx = jiffies; slave->last_arp_rx = jiffies;
...@@ -2727,10 +2725,10 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack ...@@ -2727,10 +2725,10 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
arp_ptr += 4 + dev->addr_len; arp_ptr += 4 + dev->addr_len;
memcpy(&tip, arp_ptr, 4); memcpy(&tip, arp_ptr, 4);
dprintk("bond_arp_rcv: %s %s/%d av %d sv %d sip %u.%u.%u.%u" dprintk("bond_arp_rcv: %s %s/%d av %d sv %d sip %pI4 tip %pI4\n",
" tip %u.%u.%u.%u\n", bond->dev->name, slave->dev->name, bond->dev->name, slave->dev->name, slave->state,
slave->state, bond->params.arp_validate, bond->params.arp_validate, slave_do_arp_validate(bond, slave),
slave_do_arp_validate(bond, slave), NIPQUAD(sip), NIPQUAD(tip)); &sip, &tip);
/* /*
* Backup slaves won't see the ARP reply, but do come through * Backup slaves won't see the ARP reply, but do come through
......
...@@ -672,8 +672,8 @@ static ssize_t bonding_show_arp_targets(struct device *d, ...@@ -672,8 +672,8 @@ static ssize_t bonding_show_arp_targets(struct device *d,
for (i = 0; i < BOND_MAX_ARP_TARGETS; i++) { for (i = 0; i < BOND_MAX_ARP_TARGETS; i++) {
if (bond->params.arp_targets[i]) if (bond->params.arp_targets[i])
res += sprintf(buf + res, "%u.%u.%u.%u ", res += sprintf(buf + res, "%pI4 ",
NIPQUAD(bond->params.arp_targets[i])); &bond->params.arp_targets[i]);
} }
if (res) if (res)
buf[res-1] = '\n'; /* eat the leftover space */ buf[res-1] = '\n'; /* eat the leftover space */
...@@ -695,8 +695,8 @@ static ssize_t bonding_store_arp_targets(struct device *d, ...@@ -695,8 +695,8 @@ static ssize_t bonding_store_arp_targets(struct device *d,
if (buf[0] == '+') { if (buf[0] == '+') {
if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) {
printk(KERN_ERR DRV_NAME printk(KERN_ERR DRV_NAME
": %s: invalid ARP target %u.%u.%u.%u specified for addition\n", ": %s: invalid ARP target %pI4 specified for addition\n",
bond->dev->name, NIPQUAD(newtarget)); bond->dev->name, &newtarget);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -704,8 +704,8 @@ static ssize_t bonding_store_arp_targets(struct device *d, ...@@ -704,8 +704,8 @@ static ssize_t bonding_store_arp_targets(struct device *d,
for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) { for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) {
if (targets[i] == newtarget) { /* duplicate */ if (targets[i] == newtarget) { /* duplicate */
printk(KERN_ERR DRV_NAME printk(KERN_ERR DRV_NAME
": %s: ARP target %u.%u.%u.%u is already present\n", ": %s: ARP target %pI4 is already present\n",
bond->dev->name, NIPQUAD(newtarget)); bond->dev->name, &newtarget);
if (done) if (done)
targets[i] = 0; targets[i] = 0;
ret = -EINVAL; ret = -EINVAL;
...@@ -713,8 +713,8 @@ static ssize_t bonding_store_arp_targets(struct device *d, ...@@ -713,8 +713,8 @@ static ssize_t bonding_store_arp_targets(struct device *d,
} }
if (targets[i] == 0 && !done) { if (targets[i] == 0 && !done) {
printk(KERN_INFO DRV_NAME printk(KERN_INFO DRV_NAME
": %s: adding ARP target %d.%d.%d.%d.\n", ": %s: adding ARP target %pI4.\n",
bond->dev->name, NIPQUAD(newtarget)); bond->dev->name, &newtarget);
done = 1; done = 1;
targets[i] = newtarget; targets[i] = newtarget;
} }
...@@ -731,8 +731,8 @@ static ssize_t bonding_store_arp_targets(struct device *d, ...@@ -731,8 +731,8 @@ static ssize_t bonding_store_arp_targets(struct device *d,
else if (buf[0] == '-') { else if (buf[0] == '-') {
if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) {
printk(KERN_ERR DRV_NAME printk(KERN_ERR DRV_NAME
": %s: invalid ARP target %d.%d.%d.%d specified for removal\n", ": %s: invalid ARP target %pI4 specified for removal\n",
bond->dev->name, NIPQUAD(newtarget)); bond->dev->name, &newtarget);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -740,16 +740,16 @@ static ssize_t bonding_store_arp_targets(struct device *d, ...@@ -740,16 +740,16 @@ static ssize_t bonding_store_arp_targets(struct device *d,
for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) { for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) {
if (targets[i] == newtarget) { if (targets[i] == newtarget) {
printk(KERN_INFO DRV_NAME printk(KERN_INFO DRV_NAME
": %s: removing ARP target %d.%d.%d.%d.\n", ": %s: removing ARP target %pI4.\n",
bond->dev->name, NIPQUAD(newtarget)); bond->dev->name, &newtarget);
targets[i] = 0; targets[i] = 0;
done = 1; done = 1;
} }
} }
if (!done) { if (!done) {
printk(KERN_INFO DRV_NAME printk(KERN_INFO DRV_NAME
": %s: unable to remove nonexistent ARP target %d.%d.%d.%d.\n", ": %s: unable to remove nonexistent ARP target %pI4.\n",
bond->dev->name, NIPQUAD(newtarget)); bond->dev->name, &newtarget);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
......
...@@ -1601,7 +1601,7 @@ static int iscsi_tcp_get_addr(struct iscsi_conn *conn, struct socket *sock, ...@@ -1601,7 +1601,7 @@ static int iscsi_tcp_get_addr(struct iscsi_conn *conn, struct socket *sock,
case AF_INET: case AF_INET:
sin = (struct sockaddr_in *)addr; sin = (struct sockaddr_in *)addr;
spin_lock_bh(&conn->session->lock); spin_lock_bh(&conn->session->lock);
sprintf(buf, NIPQUAD_FMT, NIPQUAD(sin->sin_addr.s_addr)); sprintf(buf, "%pI4", &sin->sin_addr.s_addr);
*port = be16_to_cpu(sin->sin_port); *port = be16_to_cpu(sin->sin_port);
spin_unlock_bh(&conn->session->lock); spin_unlock_bh(&conn->session->lock);
break; break;
......
...@@ -206,8 +206,7 @@ static int qla4xxx_conn_get_param(struct iscsi_cls_conn *conn, ...@@ -206,8 +206,7 @@ static int qla4xxx_conn_get_param(struct iscsi_cls_conn *conn,
break; break;
case ISCSI_PARAM_CONN_ADDRESS: case ISCSI_PARAM_CONN_ADDRESS:
/* TODO: what are the ipv6 bits */ /* TODO: what are the ipv6 bits */
len = sprintf(buf, "%u.%u.%u.%u\n", len = sprintf(buf, "%pI4\n", &ddb_entry->ip_addr);
NIPQUAD(ddb_entry->ip_addr));
break; break;
default: default:
return -ENOSYS; return -ENOSYS;
......
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