diff options
author | Joe Perches <joe@perches.com> | 2007-10-03 20:59:30 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:42 -0400 |
commit | 0795af5729b18218767fab27c44b1384f72dc9ad (patch) | |
tree | 67c16df84aa6ec219340b8ea1b5cfb0e8150a216 /drivers/net/tun.c | |
parent | 95ea36275f3c9a1d3d04c217b4b576c657c4e70e (diff) |
[NET]: Introduce and use print_mac() and DECLARE_MAC_BUF()
This is nicer than the MAC_FMT stuff.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r-- | drivers/net/tun.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index d8b8e68ef70b..1f7644695976 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -159,16 +159,15 @@ tun_net_mclist(struct net_device *dev) | |||
159 | struct tun_struct *tun = netdev_priv(dev); | 159 | struct tun_struct *tun = netdev_priv(dev); |
160 | const struct dev_mc_list *mclist; | 160 | const struct dev_mc_list *mclist; |
161 | int i; | 161 | int i; |
162 | DECLARE_MAC_BUF(mac); | ||
162 | DBG(KERN_DEBUG "%s: tun_net_mclist: mc_count %d\n", | 163 | DBG(KERN_DEBUG "%s: tun_net_mclist: mc_count %d\n", |
163 | dev->name, dev->mc_count); | 164 | dev->name, dev->mc_count); |
164 | memset(tun->chr_filter, 0, sizeof tun->chr_filter); | 165 | memset(tun->chr_filter, 0, sizeof tun->chr_filter); |
165 | for (i = 0, mclist = dev->mc_list; i < dev->mc_count && mclist != NULL; | 166 | for (i = 0, mclist = dev->mc_list; i < dev->mc_count && mclist != NULL; |
166 | i++, mclist = mclist->next) { | 167 | i++, mclist = mclist->next) { |
167 | add_multi(tun->net_filter, mclist->dmi_addr); | 168 | add_multi(tun->net_filter, mclist->dmi_addr); |
168 | DBG(KERN_DEBUG "%s: tun_net_mclist: %x:%x:%x:%x:%x:%x\n", | 169 | DBG(KERN_DEBUG "%s: tun_net_mclist: %s\n", |
169 | dev->name, | 170 | dev->name, print_mac(mac, mclist->dmi_addr)); |
170 | mclist->dmi_addr[0], mclist->dmi_addr[1], mclist->dmi_addr[2], | ||
171 | mclist->dmi_addr[3], mclist->dmi_addr[4], mclist->dmi_addr[5]); | ||
172 | } | 171 | } |
173 | } | 172 | } |
174 | 173 | ||
@@ -358,6 +357,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv, | |||
358 | DECLARE_WAITQUEUE(wait, current); | 357 | DECLARE_WAITQUEUE(wait, current); |
359 | struct sk_buff *skb; | 358 | struct sk_buff *skb; |
360 | ssize_t len, ret = 0; | 359 | ssize_t len, ret = 0; |
360 | DECLARE_MAC_BUF(mac); | ||
361 | 361 | ||
362 | if (!tun) | 362 | if (!tun) |
363 | return -EBADFD; | 363 | return -EBADFD; |
@@ -412,16 +412,14 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv, | |||
412 | (addr[0] == 0x33 && addr[1] == 0x33)) && | 412 | (addr[0] == 0x33 && addr[1] == 0x33)) && |
413 | ((tun->if_flags & IFF_ALLMULTI) || | 413 | ((tun->if_flags & IFF_ALLMULTI) || |
414 | (tun->chr_filter[bit_nr >> 5] & (1 << (bit_nr & 31)))))) { | 414 | (tun->chr_filter[bit_nr >> 5] & (1 << (bit_nr & 31)))))) { |
415 | DBG(KERN_DEBUG "%s: tun_chr_readv: accepted: %x:%x:%x:%x:%x:%x\n", | 415 | DBG(KERN_DEBUG "%s: tun_chr_readv: accepted: %s\n", |
416 | tun->dev->name, addr[0], addr[1], addr[2], | 416 | tun->dev->name, print_mac(mac, addr)); |
417 | addr[3], addr[4], addr[5]); | ||
418 | ret = tun_put_user(tun, skb, (struct iovec *) iv, len); | 417 | ret = tun_put_user(tun, skb, (struct iovec *) iv, len); |
419 | kfree_skb(skb); | 418 | kfree_skb(skb); |
420 | break; | 419 | break; |
421 | } else { | 420 | } else { |
422 | DBG(KERN_DEBUG "%s: tun_chr_readv: rejected: %x:%x:%x:%x:%x:%x\n", | 421 | DBG(KERN_DEBUG "%s: tun_chr_readv: rejected: %s\n", |
423 | tun->dev->name, addr[0], addr[1], addr[2], | 422 | tun->dev->name, print_mac(mac, addr)); |
424 | addr[3], addr[4], addr[5]); | ||
425 | kfree_skb(skb); | 423 | kfree_skb(skb); |
426 | continue; | 424 | continue; |
427 | } | 425 | } |
@@ -564,6 +562,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
564 | struct tun_struct *tun = file->private_data; | 562 | struct tun_struct *tun = file->private_data; |
565 | void __user* argp = (void __user*)arg; | 563 | void __user* argp = (void __user*)arg; |
566 | struct ifreq ifr; | 564 | struct ifreq ifr; |
565 | DECLARE_MAC_BUF(mac); | ||
567 | 566 | ||
568 | if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89) | 567 | if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89) |
569 | if (copy_from_user(&ifr, argp, sizeof ifr)) | 568 | if (copy_from_user(&ifr, argp, sizeof ifr)) |
@@ -692,22 +691,16 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
692 | /** Add the specified group to the character device's multicast filter | 691 | /** Add the specified group to the character device's multicast filter |
693 | * list. */ | 692 | * list. */ |
694 | add_multi(tun->chr_filter, ifr.ifr_hwaddr.sa_data); | 693 | add_multi(tun->chr_filter, ifr.ifr_hwaddr.sa_data); |
695 | DBG(KERN_DEBUG "%s: add multi: %x:%x:%x:%x:%x:%x\n", | 694 | DBG(KERN_DEBUG "%s: add multi: %s\n", |
696 | tun->dev->name, | 695 | tun->dev->name, print_mac(mac, ifr.ifr_hwaddr.sa_data)); |
697 | (u8)ifr.ifr_hwaddr.sa_data[0], (u8)ifr.ifr_hwaddr.sa_data[1], | ||
698 | (u8)ifr.ifr_hwaddr.sa_data[2], (u8)ifr.ifr_hwaddr.sa_data[3], | ||
699 | (u8)ifr.ifr_hwaddr.sa_data[4], (u8)ifr.ifr_hwaddr.sa_data[5]); | ||
700 | return 0; | 696 | return 0; |
701 | 697 | ||
702 | case SIOCDELMULTI: | 698 | case SIOCDELMULTI: |
703 | /** Remove the specified group from the character device's multicast | 699 | /** Remove the specified group from the character device's multicast |
704 | * filter list. */ | 700 | * filter list. */ |
705 | del_multi(tun->chr_filter, ifr.ifr_hwaddr.sa_data); | 701 | del_multi(tun->chr_filter, ifr.ifr_hwaddr.sa_data); |
706 | DBG(KERN_DEBUG "%s: del multi: %x:%x:%x:%x:%x:%x\n", | 702 | DBG(KERN_DEBUG "%s: del multi: %s\n", |
707 | tun->dev->name, | 703 | tun->dev->name, print_mac(mac, ifr.ifr_hwaddr.sa_data)); |
708 | (u8)ifr.ifr_hwaddr.sa_data[0], (u8)ifr.ifr_hwaddr.sa_data[1], | ||
709 | (u8)ifr.ifr_hwaddr.sa_data[2], (u8)ifr.ifr_hwaddr.sa_data[3], | ||
710 | (u8)ifr.ifr_hwaddr.sa_data[4], (u8)ifr.ifr_hwaddr.sa_data[5]); | ||
711 | return 0; | 704 | return 0; |
712 | 705 | ||
713 | default: | 706 | default: |