Commit ce5d0b47 authored by Adit Ranadive's avatar Adit Ranadive Committed by David S. Miller

[PKTGEN]: srcmac fix

From: Adit Ranadive <adit.262@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6ae5f983
...@@ -111,6 +111,9 @@ ...@@ -111,6 +111,9 @@
* *
* 802.1Q/Q-in-Q support by Francesco Fondelli (FF) <francesco.fondelli@gmail.com> * 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/sys.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -1451,8 +1454,11 @@ static ssize_t pktgen_if_write(struct file *file, ...@@ -1451,8 +1454,11 @@ static ssize_t pktgen_if_write(struct file *file,
} }
if (!strcmp(name, "src_mac")) { if (!strcmp(name, "src_mac")) {
char *v = valstr; char *v = valstr;
unsigned char old_smac[ETH_ALEN];
unsigned char *m = pkt_dev->src_mac; 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); len = strn_len(&user_buffer[i], sizeof(valstr) - 1);
if (len < 0) { if (len < 0) {
return len; return len;
...@@ -1481,6 +1487,10 @@ static ssize_t pktgen_if_write(struct file *file, ...@@ -1481,6 +1487,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"); sprintf(pg_result, "OK: srcmac");
return count; return count;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment