From 8311fa0bd8c39be7c5b2d1de4a74dce362681bca Mon Sep 17 00:00:00 2001
From: Michael Tuexen <tuexen@fh-muenster.de>
Date: Thu, 21 May 2015 10:51:17 +0200
Subject: [PATCH] Allow the interface MTU to be set to the default value.

If the interface MTU was previously set to a non-default value
and in a later run should be set to the default value, it was
not set correctly. With this patch, the MTU is always set.
---
 gtests/net/packetdrill/netdev.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/gtests/net/packetdrill/netdev.c b/gtests/net/packetdrill/netdev.c
index 5add164d..74c13155 100644
--- a/gtests/net/packetdrill/netdev.c
+++ b/gtests/net/packetdrill/netdev.c
@@ -111,6 +111,8 @@ static void check_remote_address(struct config *config,
 /* Create a tun device for the lifetime of this test. */
 static void create_device(struct config *config, struct local_netdev *netdev)
 {
+	char *command;
+
 	/* Open the tun device, which "clones" it for our purposes. */
 	int tun_fd = open(TUN_PATH, O_RDWR);
 	if (tun_fd < 0)
@@ -177,14 +179,10 @@ static void create_device(struct config *config, struct local_netdev *netdev)
 		free(command);
 	}
 
-	if (config->mtu != TUN_DRIVER_DEFAULT_MTU) {
-		char *command;
-		asprintf(&command, "ifconfig %s mtu %d",
-			 netdev->name, config->mtu);
-		if (system(command) < 0)
-			die("Error executing %s\n", command);
-		free(command);
-	}
+	asprintf(&command, "ifconfig %s mtu %d", netdev->name, config->mtu);
+	if (system(command) < 0)
+		die("Error executing %s\n", command);
+	free(command);
 
 	/* Open a socket we can use to configure the tun interface.
 	 * We only open up an AF_INET6 socket on-demand as needed,
-- 
GitLab