if_tun.c (345313) | if_tun.c (347376) |
---|---|
1/* $NetBSD: if_tun.c,v 1.14 1994/06/29 06:36:25 cgd Exp $ */ 2 3/*- 4 * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk> 5 * Nottingham University 1987. 6 * 7 * This source may be freely distributed, however I would be interested 8 * in any changes that are made. 9 * 10 * This driver takes packets off the IP i/f and hands them up to a 11 * user process to have its wicked way with. This driver has it's 12 * roots in a similar driver written by Phil Cockcroft (formerly) at 13 * UCL. This driver is based much more on read/write/poll mode of 14 * operation though. 15 * | 1/* $NetBSD: if_tun.c,v 1.14 1994/06/29 06:36:25 cgd Exp $ */ 2 3/*- 4 * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk> 5 * Nottingham University 1987. 6 * 7 * This source may be freely distributed, however I would be interested 8 * in any changes that are made. 9 * 10 * This driver takes packets off the IP i/f and hands them up to a 11 * user process to have its wicked way with. This driver has it's 12 * roots in a similar driver written by Phil Cockcroft (formerly) at 13 * UCL. This driver is based much more on read/write/poll mode of 14 * operation though. 15 * |
16 * $FreeBSD: stable/11/sys/net/if_tun.c 345313 2019-03-20 01:55:24Z kp $ | 16 * $FreeBSD: stable/11/sys/net/if_tun.c 347376 2019-05-09 01:16:03Z kevans $ |
17 */ 18 19#include "opt_inet.h" 20#include "opt_inet6.h" 21 22#include <sys/param.h> 23#include <sys/priv.h> 24#include <sys/proc.h> --- 699 unchanged lines hidden (view full) --- 724 725 switch (cmd) { 726 case TUNSIFINFO: 727 tunp = (struct tuninfo *)data; 728 if (TUN2IFP(tp)->if_type != tunp->type) 729 return (EPROTOTYPE); 730 mtx_lock(&tp->tun_mtx); 731 if (TUN2IFP(tp)->if_mtu != tunp->mtu) { | 17 */ 18 19#include "opt_inet.h" 20#include "opt_inet6.h" 21 22#include <sys/param.h> 23#include <sys/priv.h> 24#include <sys/proc.h> --- 699 unchanged lines hidden (view full) --- 724 725 switch (cmd) { 726 case TUNSIFINFO: 727 tunp = (struct tuninfo *)data; 728 if (TUN2IFP(tp)->if_type != tunp->type) 729 return (EPROTOTYPE); 730 mtx_lock(&tp->tun_mtx); 731 if (TUN2IFP(tp)->if_mtu != tunp->mtu) { |
732 strncpy(ifr.ifr_name, if_name(TUN2IFP(tp)), IFNAMSIZ); | 732 strlcpy(ifr.ifr_name, if_name(TUN2IFP(tp)), IFNAMSIZ); |
733 ifr.ifr_mtu = tunp->mtu; 734 CURVNET_SET(TUN2IFP(tp)->if_vnet); 735 error = ifhwioctl(SIOCSIFMTU, TUN2IFP(tp), 736 (caddr_t)&ifr, td); 737 CURVNET_RESTORE(); 738 if (error) { 739 mtx_unlock(&tp->tun_mtx); 740 return (error); --- 356 unchanged lines hidden --- | 733 ifr.ifr_mtu = tunp->mtu; 734 CURVNET_SET(TUN2IFP(tp)->if_vnet); 735 error = ifhwioctl(SIOCSIFMTU, TUN2IFP(tp), 736 (caddr_t)&ifr, td); 737 CURVNET_RESTORE(); 738 if (error) { 739 mtx_unlock(&tp->tun_mtx); 740 return (error); --- 356 unchanged lines hidden --- |