From: Adit Ranadive Date: Sun, 16 Sep 2007 21:52:15 +0000 (-0700) Subject: [PKTGEN]: srcmac fix X-Git-Tag: v2.6.23-rc7~33^2~11 X-Git-Url: http://pilppa.org/gitweb/?a=commitdiff_plain;h=ce5d0b47f13f83dfb9fbb8ac91adad7120747aaf;p=linux-2.6-omap-h63xx.git [PKTGEN]: srcmac fix From: Adit Ranadive Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 36fdea71d74..803d0c8826a 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) * + * Fixed src_mac command to set source mac of packet to value specified in + * command by Adit Ranadive + * */ #include #include @@ -1451,8 +1454,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; @@ -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"); return count; }