diff options
author | Adit Ranadive <adit.262@gmail.com> | 2007-09-16 17:52:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-09-16 17:52:15 -0400 |
commit | ce5d0b47f13f83dfb9fbb8ac91adad7120747aaf (patch) | |
tree | f1d24348ac9244b30433aa335f870ff9a21d54fa /net | |
parent | 6ae5f983cf8de769214d2d9e8a783c881eccd4cd (diff) |
[PKTGEN]: srcmac fix
From: Adit Ranadive <adit.262@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-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 36fdea71d742..803d0c8826af 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -111,6 +111,9 @@ | |||
111 | * | 111 | * |
112 | * 802.1Q/Q-in-Q support by Francesco Fondelli (FF) <francesco.fondelli@gmail.com> | 112 | * 802.1Q/Q-in-Q support by Francesco Fondelli (FF) <francesco.fondelli@gmail.com> |
113 | * | 113 | * |
114 | * Fixed src_mac command to set source mac of packet to value specified in | ||
115 | * command by Adit Ranadive <adit.262@gmail.com> | ||
116 | * | ||
114 | */ | 117 | */ |
115 | #include <linux/sys.h> | 118 | #include <linux/sys.h> |
116 | #include <linux/types.h> | 119 | #include <linux/types.h> |
@@ -1451,8 +1454,11 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1451 | } | 1454 | } |
1452 | if (!strcmp(name, "src_mac")) { | 1455 | if (!strcmp(name, "src_mac")) { |
1453 | char *v = valstr; | 1456 | char *v = valstr; |
1457 | unsigned char old_smac[ETH_ALEN]; | ||
1454 | unsigned char *m = pkt_dev->src_mac; | 1458 | unsigned char *m = pkt_dev->src_mac; |
1455 | 1459 | ||
1460 | memcpy(old_smac, pkt_dev->src_mac, ETH_ALEN); | ||
1461 | |||
1456 | len = strn_len(&user_buffer[i], sizeof(valstr) - 1); | 1462 | len = strn_len(&user_buffer[i], sizeof(valstr) - 1); |
1457 | if (len < 0) { | 1463 | if (len < 0) { |
1458 | return len; | 1464 | return len; |
@@ -1481,6 +1487,10 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1481 | } | 1487 | } |
1482 | } | 1488 | } |
1483 | 1489 | ||
1490 | /* Set up Src MAC */ | ||
1491 | if (compare_ether_addr(old_smac, pkt_dev->src_mac)) | ||
1492 | memcpy(&(pkt_dev->hh[6]), pkt_dev->src_mac, ETH_ALEN); | ||
1493 | |||
1484 | sprintf(pg_result, "OK: srcmac"); | 1494 | sprintf(pg_result, "OK: srcmac"); |
1485 | return count; | 1495 | return count; |
1486 | } | 1496 | } |