if_tun.c (36735) | if_tun.c (41086) |
---|---|
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. --- 16 unchanged lines hidden (view full) --- 25#include <sys/systm.h> 26#include <sys/mbuf.h> 27#include <sys/socket.h> 28#include <sys/filio.h> 29#include <sys/sockio.h> 30#include <sys/ttycom.h> 31#include <sys/poll.h> 32#include <sys/signalvar.h> | 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. --- 16 unchanged lines hidden (view full) --- 25#include <sys/systm.h> 26#include <sys/mbuf.h> 27#include <sys/socket.h> 28#include <sys/filio.h> 29#include <sys/sockio.h> 30#include <sys/ttycom.h> 31#include <sys/poll.h> 32#include <sys/signalvar.h> |
33#include <sys/filedesc.h> |
|
33#include <sys/kernel.h> 34#include <sys/sysctl.h> 35#ifdef DEVFS 36#include <sys/devfsext.h> 37#endif /*DEVFS*/ 38#include <sys/conf.h> 39#include <sys/uio.h> 40/* --- 169 unchanged lines hidden (view full) --- 210 if (ifa->ifa_addr->sa_family == AF_INET) { 211 rtinit(ifa, (int)RTM_DELETE, 212 tp->tun_flags & TUN_DSTADDR ? RTF_HOST : 0); 213 } 214 } 215 } 216 splx(s); 217 } | 34#include <sys/kernel.h> 35#include <sys/sysctl.h> 36#ifdef DEVFS 37#include <sys/devfsext.h> 38#endif /*DEVFS*/ 39#include <sys/conf.h> 40#include <sys/uio.h> 41/* --- 169 unchanged lines hidden (view full) --- 211 if (ifa->ifa_addr->sa_family == AF_INET) { 212 rtinit(ifa, (int)RTM_DELETE, 213 tp->tun_flags & TUN_DSTADDR ? RTF_HOST : 0); 214 } 215 } 216 } 217 splx(s); 218 } |
218 tp->tun_pgrp = 0; | 219 funsetown(tp->tun_sigio); |
219 selwakeup(&tp->tun_rsel); 220 221 TUNDEBUG ("%s%d: closed\n", ifp->if_name, ifp->if_unit); 222 return (0); 223} 224 225static int 226tuninit(unit) --- 140 unchanged lines hidden (view full) --- 367 m_freem(m0); 368 return EAFNOSUPPORT; 369 } 370 371 if (tp->tun_flags & TUN_RWAIT) { 372 tp->tun_flags &= ~TUN_RWAIT; 373 wakeup((caddr_t)tp); 374 } | 220 selwakeup(&tp->tun_rsel); 221 222 TUNDEBUG ("%s%d: closed\n", ifp->if_name, ifp->if_unit); 223 return (0); 224} 225 226static int 227tuninit(unit) --- 140 unchanged lines hidden (view full) --- 368 m_freem(m0); 369 return EAFNOSUPPORT; 370 } 371 372 if (tp->tun_flags & TUN_RWAIT) { 373 tp->tun_flags &= ~TUN_RWAIT; 374 wakeup((caddr_t)tp); 375 } |
375 if (tp->tun_flags & TUN_ASYNC && tp->tun_pgrp) { 376 if (tp->tun_pgrp > 0) 377 gsignal(tp->tun_pgrp, SIGIO); 378 else if ((p = pfind(-tp->tun_pgrp)) != 0) 379 psignal(p, SIGIO); 380 } | 376 if (tp->tun_flags & TUN_ASYNC && tp->tun_sigio) 377 pgsigio(tp->tun_sigio, SIGIO, 0); |
381 selwakeup(&tp->tun_rsel); 382 return 0; 383} 384 385/* 386 * the cdevsw interface is now pretty minimal. 387 */ 388static int --- 40 unchanged lines hidden (view full) --- 429 if (tp->tun_if.if_snd.ifq_head) { 430 struct mbuf *mb = tp->tun_if.if_snd.ifq_head; 431 for( *(int *)data = 0; mb != 0; mb = mb->m_next) 432 *(int *)data += mb->m_len; 433 } else 434 *(int *)data = 0; 435 splx(s); 436 break; | 378 selwakeup(&tp->tun_rsel); 379 return 0; 380} 381 382/* 383 * the cdevsw interface is now pretty minimal. 384 */ 385static int --- 40 unchanged lines hidden (view full) --- 426 if (tp->tun_if.if_snd.ifq_head) { 427 struct mbuf *mb = tp->tun_if.if_snd.ifq_head; 428 for( *(int *)data = 0; mb != 0; mb = mb->m_next) 429 *(int *)data += mb->m_len; 430 } else 431 *(int *)data = 0; 432 splx(s); 433 break; |
434 case FIOSETOWN: 435 return (fsetown(*(int *)data, &tp->tun_sigio)); 436 437 case FIOGETOWN: 438 *(int *)data = fgetown(tp->tun_sigio); 439 return (0); 440 441 /* This is deprecated, FIOSETOWN should be used instead. */ |
|
437 case TIOCSPGRP: | 442 case TIOCSPGRP: |
438 tp->tun_pgrp = *(int *)data; 439 break; | 443 return (fsetown(-(*(int *)data), &tp->tun_sigio)); 444 445 /* This is deprecated, FIOGETOWN should be used instead. */ |
440 case TIOCGPGRP: | 446 case TIOCGPGRP: |
441 *(int *)data = tp->tun_pgrp; 442 break; | 447 *(int *)data = -fgetown(tp->tun_sigio); 448 return (0); 449 |
443 default: 444 return (ENOTTY); 445 } 446 return (0); 447} 448 449/* 450 * The cdevsw read interface - reads a packet at a time, or at --- 188 unchanged lines hidden --- | 450 default: 451 return (ENOTTY); 452 } 453 return (0); 454} 455 456/* 457 * The cdevsw read interface - reads a packet at a time, or at --- 188 unchanged lines hidden --- |