diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2008-10-30 01:43:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-30 01:43:33 -0400 |
commit | 8cf14e38372d84ea09ba45fb60b61f6e36c18546 (patch) | |
tree | 56f777828ff7109808407b8a348c31ac74d5b558 /drivers/isdn | |
parent | 9edb8bb68b5ea63061ba833831b00c229ac9fbd2 (diff) |
net: easy removals of HIPQUAD using %pI4 format
As a bonus, removes some unnecessary byteswapping.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/i4l/isdn_net.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index bb904a0a98bd..60c82d7b12a8 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
@@ -1654,9 +1654,10 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb) | |||
1654 | unsigned char *p; | 1654 | unsigned char *p; |
1655 | int period; | 1655 | int period; |
1656 | u32 code; | 1656 | u32 code; |
1657 | u32 my_seq, addr; | 1657 | u32 my_seq; |
1658 | u32 your_seq, mask; | 1658 | u32 your_seq; |
1659 | u32 local; | 1659 | __be32 local; |
1660 | __be32 *addr, *mask; | ||
1660 | u16 unused; | 1661 | u16 unused; |
1661 | 1662 | ||
1662 | if (skb->len < 14) | 1663 | if (skb->len < 14) |
@@ -1671,27 +1672,20 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb) | |||
1671 | isdn_net_ciscohdlck_slarp_send_reply(lp); | 1672 | isdn_net_ciscohdlck_slarp_send_reply(lp); |
1672 | break; | 1673 | break; |
1673 | case CISCO_SLARP_REPLY: | 1674 | case CISCO_SLARP_REPLY: |
1674 | addr = ntohl(*(u32 *)p); | 1675 | addr = (__be32 *)p; |
1675 | mask = ntohl(*(u32 *)(p+4)); | 1676 | mask = (__be32 *)(p + 4); |
1676 | if (mask != 0xfffffffc) | 1677 | if (*mask != cpu_to_be32(0xfffffffc)) |
1677 | goto slarp_reply_out; | 1678 | goto slarp_reply_out; |
1678 | if ((addr & 3) == 0 || (addr & 3) == 3) | 1679 | if ((*addr & cpu_to_be32(3)) == cpu_to_be32(0) || |
1680 | (*addr & cpu_to_be32(3)) == cpu_to_be32(3)) | ||
1679 | goto slarp_reply_out; | 1681 | goto slarp_reply_out; |
1680 | local = addr ^ 3; | 1682 | local = *addr ^ cpu_to_be32(3); |
1681 | printk(KERN_INFO "%s: got slarp reply: " | 1683 | printk(KERN_INFO "%s: got slarp reply: remote ip: %pI4, local ip: %pI4 mask: %pI4\n", |
1682 | "remote ip: %d.%d.%d.%d, " | 1684 | lp->netdev->dev->name, addr, &local, mask); |
1683 | "local ip: %d.%d.%d.%d " | ||
1684 | "mask: %d.%d.%d.%d\n", | ||
1685 | lp->netdev->dev->name, | ||
1686 | HIPQUAD(addr), | ||
1687 | HIPQUAD(local), | ||
1688 | HIPQUAD(mask)); | ||
1689 | break; | 1685 | break; |
1690 | slarp_reply_out: | 1686 | slarp_reply_out: |
1691 | printk(KERN_INFO "%s: got invalid slarp " | 1687 | printk(KERN_INFO "%s: got invalid slarp reply (%pI4/%pI4) - ignored\n", |
1692 | "reply (%d.%d.%d.%d/%d.%d.%d.%d) " | 1688 | lp->netdev->dev->name, addr, mask); |
1693 | "- ignored\n", lp->netdev->dev->name, | ||
1694 | HIPQUAD(addr), HIPQUAD(mask)); | ||
1695 | break; | 1689 | break; |
1696 | case CISCO_SLARP_KEEPALIVE: | 1690 | case CISCO_SLARP_KEEPALIVE: |
1697 | period = (int)((jiffies - lp->cisco_last_slarp_in | 1691 | period = (int)((jiffies - lp->cisco_last_slarp_in |