Date: Thu, 19 Dec 2013 10:10:23 GMT From: Yuri <yuri@rawbw.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/184988: [PORT net-mgmt/aircrack-ng] Added MTU get/set operations Message-ID: <201312191010.rBJAANWV026563@oldred.freebsd.org> Resent-Message-ID: <201312191020.rBJAK0uC047659@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 184988 >Category: ports >Synopsis: [PORT net-mgmt/aircrack-ng] Added MTU get/set operations >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Dec 19 10:20:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Yuri >Release: 9.2 >Organization: n/a >Environment: >Description: Please add this patch on top of existing ones for the file freebsd.c >How-To-Repeat: >Fix: Patch attached with submission follows: --- 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); >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312191010.rBJAANWV026563>