--- src/osdep/freebsd.c 2013-12-18 14:02:41.000000000 -0800 +++ src/osdep/freebsd.c 2013-12-19 02:04:28.000000000 -0800 @@ -42,6 +42,7 @@ #include "osdep.h" + struct priv_fbsd { /* iface */ int pf_fd; @@ -522,6 +523,39 @@ return ioctl(priv->pf_s, SIOCSIFLLADDR, ifr); } +static int fbsd_set_mtu(struct wif *wi, int mtu) +{ + struct priv_fbsd *priv = wi_priv(wi); + struct ifreq *ifr = &priv->pf_ifr; + + memset( ifr, 0, sizeof( struct ifreq ) ); + + strncpy( ifr->ifr_name, wi_get_ifname(wi), sizeof( ifr->ifr_name ) ); + ifr->ifr_mtu = mtu; + + if( ioctl( priv->pf_s, SIOCSIFMTU, ifr ) < 0 ) + return( -1 ); + + return 0; +} + +static int fbsd_get_mtu(struct wif *wi) +{ + struct priv_fbsd *priv = wi_priv(wi); + struct ifreq ifr; + + memset( &ifr, 0, sizeof( struct ifreq ) ); + + ifr.ifr_addr.sa_family = AF_INET; + + strncpy( ifr.ifr_name, wi_get_ifname(wi), sizeof( ifr.ifr_name ) ); + + if( ioctl( priv->pf_s, SIOCGIFMTU, (caddr_t)&ifr ) < 0 ) + return( -1 ); + + return ifr.ifr_mtu; +} + static struct wif *fbsd_open(char *iface) { struct wif *wi; @@ -542,7 +576,9 @@ wi->wi_set_mac = fbsd_set_mac; wi->wi_get_rate = fbsd_get_rate; wi->wi_set_rate = fbsd_set_rate; - wi->wi_get_monitor = fbsd_get_monitor; + wi->wi_get_monitor = fbsd_get_monitor; + wi->wi_get_mtu = fbsd_get_mtu; + wi->wi_set_mtu = fbsd_set_mtu; /* setup iface */ fd = do_fbsd_open(wi, iface);