aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-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;
}