summaryrefslogtreecommitdiff
path: root/trafgen_l3.c
diff options
context:
space:
mode:
Diffstat (limited to 'trafgen_l3.c')
-rw-r--r--trafgen_l3.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/trafgen_l3.c b/trafgen_l3.c
index 70aefb9..7c8a786 100644
--- a/trafgen_l3.c
+++ b/trafgen_l3.c
@@ -3,9 +3,10 @@
* Subject to the GPL, version 2.
*/
-#include <linux/if_ether.h>
+#include <net/if_arp.h>
#include "die.h"
+#include "dev.h"
#include "csum.h"
#include "built_in.h"
#include "trafgen_l2.h"
@@ -34,7 +35,11 @@ static struct proto_field ipv4_fields[] = {
static void ipv4_header_init(struct proto_hdr *hdr)
{
- proto_lower_default_add(hdr, PROTO_ETH);
+ const char *dev = proto_dev_get();
+
+ /* In case of tun interface we do not need to create Ethernet header */
+ if (dev && device_mtu(dev) && device_type(dev) != ARPHRD_NONE)
+ proto_lower_default_add(hdr, PROTO_ETH);
proto_header_fields_add(hdr, ipv4_fields, array_size(ipv4_fields));
@@ -135,7 +140,11 @@ static struct proto_field ipv6_fields[] = {
static void ipv6_header_init(struct proto_hdr *hdr)
{
- proto_lower_default_add(hdr, PROTO_ETH);
+ const char *dev = proto_dev_get();
+
+ /* In case of tun interface we do not need to create Ethernet header */
+ if (dev && device_mtu(dev) && device_type(dev) != ARPHRD_NONE)
+ proto_lower_default_add(hdr, PROTO_ETH);
proto_header_fields_add(hdr, ipv6_fields, array_size(ipv6_fields));
value from platform data leds: pca963x: workaround group blink scaling issue cleanup LED documentation and make it match reality leds: lp3952: Export I2C module alias information for module autoload leds: mc13783: Fix MC13892 keypad led access ledtrig-cpu.c: fix english leds/leds-lp5523.txt: make documentation match reality tools/leds: Add uledmon program for monitoring userspace LEDs leds: Use macro for max device node name size leds: Introduce userspace LED class driver mfd: qcom-pm8xxx: Clean up PM8XXX namespace
Diffstat (limited to 'arch')