On 01/20/2013 11:22 AM, Roman Bogorodskiy wrote: > --- > src/util/virnetdev.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c > index cd2b773..3f2b5f8 100644 > --- a/src/util/virnetdev.c > +++ b/src/util/virnetdev.c > @@ -412,6 +412,31 @@ cleanup: > VIR_FORCE_CLOSE(fd); > return ret; > } > +#elif defined(__FreeBSD__) > +int virNetDevGetMTU(const char *ifname) > +{ > + int s; > + int ret; > + struct ifreq ifr; > + > + if ((s = virNetDevSetupControl(ifname, &ifr)) < 0) > + return -1; > + > + ifr.ifr_addr.sa_family = AF_INET; The above line is the only difference between this and the Linux version, so why not just use a single function (as you did with virNetDevSetName() in 1/5)? > + if (ioctl(s, SIOCGIFMTU, (caddr_t)&ifr) < 0) { > + virReportSystemError(errno, > + _("Cannot get interface MTU on '%s'"), > + ifname); > + ret = -1; > + goto cleanup; > + } > + > + ret = ifr.ifr_mtu; > + > +cleanup: > + VIR_FORCE_CLOSE(s); > + return ret; > +} > #else > int virNetDevGetMTU(const char *ifname) > { -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list