diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-29 06:54:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-29 06:54:01 -0500 |
commit | 0ba6c33bcddc64a54b5f1c25a696c4767dc76292 (patch) | |
tree | 62e616f97a4762d8e75bf732e4827af2d15d52c5 /net/ethernet | |
parent | 21af0297c7e56024a5ccc4d8ad2a590f9ec371ba (diff) | |
parent | 85040bcb4643cba578839e953f25e2d1965d83d0 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25: (1470 commits)
[IPV6] ADDRLABEL: Fix double free on label deletion.
[PPP]: Sparse warning fixes.
[IPV4] fib_trie: remove unneeded NULL check
[IPV4] fib_trie: More whitespace cleanup.
[NET_SCHED]: Use nla_policy for attribute validation in ematches
[NET_SCHED]: Use nla_policy for attribute validation in actions
[NET_SCHED]: Use nla_policy for attribute validation in classifiers
[NET_SCHED]: Use nla_policy for attribute validation in packet schedulers
[NET_SCHED]: sch_api: introduce constant for rate table size
[NET_SCHED]: Use typeful attribute parsing helpers
[NET_SCHED]: Use typeful attribute construction helpers
[NET_SCHED]: Use NLA_PUT_STRING for string dumping
[NET_SCHED]: Use nla_nest_start/nla_nest_end
[NET_SCHED]: Propagate nla_parse return value
[NET_SCHED]: act_api: use PTR_ERR in tcf_action_init/tcf_action_get
[NET_SCHED]: act_api: use nlmsg_parse
[NET_SCHED]: act_api: fix netlink API conversion bug
[NET_SCHED]: sch_netem: use nla_parse_nested_compat
[NET_SCHED]: sch_atm: fix format string warning
[NETNS]: Add namespace for ICMP replying code.
...
Diffstat (limited to 'net/ethernet')
-rw-r--r-- | net/ethernet/eth.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index 6b2e454ae313..a7b417523e9b 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c | |||
@@ -359,10 +359,34 @@ struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count) | |||
359 | } | 359 | } |
360 | EXPORT_SYMBOL(alloc_etherdev_mq); | 360 | EXPORT_SYMBOL(alloc_etherdev_mq); |
361 | 361 | ||
362 | char *print_mac(char *buf, const u8 *addr) | 362 | static size_t _format_mac_addr(char *buf, int buflen, |
363 | const unsigned char *addr, int len) | ||
363 | { | 364 | { |
364 | sprintf(buf, MAC_FMT, | 365 | int i; |
365 | addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); | 366 | char *cp = buf; |
367 | |||
368 | for (i = 0; i < len; i++) { | ||
369 | cp += scnprintf(cp, buflen - (cp - buf), "%02x", addr[i]); | ||
370 | if (i == len - 1) | ||
371 | break; | ||
372 | cp += strlcpy(cp, ":", buflen - (cp - buf)); | ||
373 | } | ||
374 | return cp - buf; | ||
375 | } | ||
376 | |||
377 | ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len) | ||
378 | { | ||
379 | size_t l; | ||
380 | |||
381 | l = _format_mac_addr(buf, PAGE_SIZE, addr, len); | ||
382 | l += strlcpy(buf + l, "\n", PAGE_SIZE - l); | ||
383 | return ((ssize_t) l); | ||
384 | } | ||
385 | EXPORT_SYMBOL(sysfs_format_mac); | ||
386 | |||
387 | char *print_mac(char *buf, const unsigned char *addr) | ||
388 | { | ||
389 | _format_mac_addr(buf, MAC_BUF_SIZE, addr, ETH_ALEN); | ||
366 | return buf; | 390 | return buf; |
367 | } | 391 | } |
368 | EXPORT_SYMBOL(print_mac); | 392 | EXPORT_SYMBOL(print_mac); |