Netdev List
 help / color / mirror / Atom feed
From: "Adit Ranadive" <adit.262@gmail.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org
Subject: PATCH - Pktgen srcmac fix - Kernel 2.6.22.6
Date: Sat, 1 Sep 2007 21:18:35 -0400	[thread overview]
Message-ID: <d2ad857f0709011818o7954b40csfc9d5267f9fb3f8b@mail.gmail.com> (raw)

diff -urNp linux-orig/net/core/pktgen.c linux-mod/net/core/pktgen.c
--- linux-orig/net/core/pktgen.c        2007-08-31 02:21:01.000000000 -0400
+++ linux-mod/net/core/pktgen.c 2007-09-01 20:51:22.000000000 -0400
@@ -111,6 +111,9 @@
  *
  * 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/types.h>
@@ -1415,7 +1418,9 @@ static ssize_t pktgen_if_write(struct fi
        }
        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) {
@@ -1445,6 +1450,10 @@ static ssize_t pktgen_if_write(struct fi
                        }
                }

+               /* 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;
        }


-- 
Adit Ranadive
MS CS Candidate
Georgia Institute of Technology,
Atlanta, GA

                 reply	other threads:[~2007-09-02  1:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d2ad857f0709011818o7954b40csfc9d5267f9fb3f8b@mail.gmail.com \
    --to=adit.262@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox