diff options
author | brian <brian@FreeBSD.org> | 1999-04-26 08:54:34 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-04-26 08:54:34 +0000 |
commit | 42c76b892b2a251304d2676dc4406866b70ee8c2 (patch) | |
tree | 70f19a932d140e44302dcaa278b6b8c44baa30b4 /usr.sbin/ppp/tun.c | |
parent | d1f60b18e9169cfefff4540b6d27ae1e2b181471 (diff) | |
download | FreeBSD-src-42c76b892b2a251304d2676dc4406866b70ee8c2.zip FreeBSD-src-42c76b892b2a251304d2676dc4406866b70ee8c2.tar.gz |
Add support for NetBSD
Diffstat (limited to 'usr.sbin/ppp/tun.c')
-rw-r--r-- | usr.sbin/ppp/tun.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/usr.sbin/ppp/tun.c b/usr.sbin/ppp/tun.c index 8d578b4..90a3665 100644 --- a/usr.sbin/ppp/tun.c +++ b/usr.sbin/ppp/tun.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: tun.c,v 1.11 1999/01/28 01:56:34 brian Exp $ + * $Id: tun.c,v 1.12 1999/04/26 08:54:25 brian Exp $ */ #include <sys/param.h> @@ -39,6 +39,10 @@ #include <errno.h> #include <string.h> #include <sys/ioctl.h> +#ifdef __NetBSD__ +#include <stdio.h> +#include <unistd.h> +#endif #include "mbuf.h" #include "log.h" @@ -66,6 +70,25 @@ void tun_configure(struct bundle *bundle, int mtu) { +#ifdef __NetBSD__ + struct ifreq ifr; + int s; + + s = socket(AF_INET, SOCK_DGRAM, 0); + + if (s < 0) { + log_Printf(LogERROR, "tun_configure: socket(): %s\n", strerror(errno)); + return; + } + + sprintf(ifr.ifr_name, "tun%d", bundle->unit); + ifr.ifr_mtu = mtu; + if (ioctl(s, SIOCSIFMTU, &ifr) < 0) + log_Printf(LogERROR, "tun_configure: ioctl(SIOCSIFMTU): %s\n", + strerror(errno)); + + close(s); +#else struct tuninfo info; memset(&info, '\0', sizeof info); @@ -86,4 +109,5 @@ tun_configure(struct bundle *bundle, int mtu) if (ioctl(bundle->dev.fd, TUNSIFINFO, &info) < 0) log_Printf(LogERROR, "tun_configure: ioctl(TUNSIFINFO): %s\n", strerror(errno)); +#endif } |