diff options
author | Adit Ranadive <adit.262@gmail.com> | 2007-09-20 23:40:03 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-09-26 21:54:43 +0400 |
commit | 13af16119a223fdb9fa99dec8abf978f15480321 (patch) | |
tree | 71ae5e514356270b46e5ff65c294abb5bd87b80c /net/core | |
parent | bbaded590e3293abbbca4d58a8fb7ad8447b2640 (diff) | |
download | linux-13af16119a223fdb9fa99dec8abf978f15480321.tar.xz |
Fix pktgen src_mac handling.
commit ce5d0b47f13f83dfb9fbb8ac91adad7120747aaf in mainline
Subject: [PATCH] [PKTGEN]: srcmac fix
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/pktgen.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 9cd3a1cb60ef..33190c3c7410 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -111,6 +111,9 @@ * * 802.1Q/Q-in-Q support by Francesco Fondelli (FF) <francesco.fondelli@gmail.com> * + * Fixed src_mac command to set source mac of packet to value specified in + * command by Adit Ranadive <adit.262@gmail.com> + * */ #include <linux/sys.h> #include <linux/types.h> @@ -1415,8 +1418,11 @@ static ssize_t pktgen_if_write(struct file *file, } if (!strcmp(name, "src_mac")) { char *v = valstr; + unsigned char old_smac[ETH_ALEN]; unsigned char *m = pkt_dev->src_mac; + memcpy(old_smac, pkt_dev->src_mac, ETH_ALEN); + len = strn_len(&user_buffer[i], sizeof(valstr) - 1); if (len < 0) { return len; @@ -1445,6 +1451,10 @@ static ssize_t pktgen_if_write(struct file *file, } } + /* Set up Src MAC */ + if (compare_ether_addr(old_smac, pkt_dev->src_mac)) + memcpy(&(pkt_dev->hh[6]), pkt_dev->src_mac, ETH_ALEN); + sprintf(pg_result, "OK: srcmac"); return count; } |