[PATCH] Obtain interface MTU on FreeBSD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi. I've been sitting on some changes for vblade for some time now and I 
remembered to clean them up and contribute them back, so here's one.

diff --git a/vblade/freebsd.c b/vblade/freebsd.c
--- a/vblade/freebsd.c
+++ b/vblade/freebsd.c
@@ -261,7 +261,24 @@
  int
  getmtu(int fd, char *name)
  {
-	return 1500;
+	struct ifreq xx;
+    int s,n;
+
+	s = socket(AF_INET, SOCK_RAW, 0);
+    if (s == -1)
+    {
+	  perror("Can't get mtu");
+	  return 1500;
+	}
+	xx.ifr_addr.sa_family = AF_INET;
+	strcpy(xx.ifr_name, name);
+	n = ioctl(s,SIOCGIFMTU, &xx);
+	if (n == -1) {
+	  perror("Can't get mtu");
+	  return 1500;
+	}
+	close(s);
+	return xx.ifr_mtu;
  }
  
  vlong



------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Aoetools-discuss mailing list
Aoetools-discuss@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/aoetools-discuss




[Index of Archives]     [Linux ARM Kernel]     [Linux SCSI]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux