summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdit Ranadive <adit.262@gmail.com>2007-11-02 23:05:27 +0100
committerAdrian Bunk <bunk@kernel.org>2007-11-03 00:56:44 +0100
commit09e1acaea2074c5ae5d6d81f53f8c7f50c53593c (patch)
tree797ba8ebfefa9f87c96f17ca0b4fad5ce27d04dc
parenta52dfa535d04a5246927b9863a5e6209c5832582 (diff)
downloadlinux-stable-09e1acaea2074c5ae5d6d81f53f8c7f50c53593c.tar.gz
linux-stable-09e1acaea2074c5ae5d6d81f53f8c7f50c53593c.tar.bz2
linux-stable-09e1acaea2074c5ae5d6d81f53f8c7f50c53593c.zip
[PKTGEN]: srcmac fix
Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Adrian Bunk <bunk@kernel.org>
-rw-r--r--net/core/pktgen.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 6e972e489b6d..7bde446a0d4b 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -367,6 +367,9 @@ struct pktgen_thread {
* Copyright 1994, University of Cambridge Computer Laboratory
* All Rights Reserved.
*
+ * Fixed src_mac command to set source mac of packet to value specified in
+ * command by Adit Ranadive <adit.262@gmail.com>
+ *
*/
static inline s64 divremdi3(s64 x, s64 y, int type)
{
@@ -1228,8 +1231,11 @@ static ssize_t pktgen_if_write(struct file *file, const char __user *user_buffer
}
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; }
memset(valstr, 0, sizeof(valstr));
@@ -1256,6 +1262,10 @@ static ssize_t pktgen_if_write(struct file *file, const char __user *user_buffer
}
}
+ /* 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;
}