if_tap.c (148868) | if_tap.c (148887) |
---|---|
1/*- 2 * Copyright (C) 1999-2000 by Maksim Yevmenkin <m_evmenkin@yahoo.com> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * BASED ON: 27 * ------------------------------------------------------------------------- 28 * 29 * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk> 30 * Nottingham University 1987. 31 */ 32 33/* | 1/*- 2 * Copyright (C) 1999-2000 by Maksim Yevmenkin <m_evmenkin@yahoo.com> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * BASED ON: 27 * ------------------------------------------------------------------------- 28 * 29 * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk> 30 * Nottingham University 1987. 31 */ 32 33/* |
34 * $FreeBSD: head/sys/net/if_tap.c 148868 2005-08-08 19:55:32Z rwatson $ | 34 * $FreeBSD: head/sys/net/if_tap.c 148887 2005-08-09 10:20:02Z rwatson $ |
35 * $Id: if_tap.c,v 0.21 2000/07/23 21:46:02 max Exp $ 36 */ 37 38#include "opt_inet.h" 39 40#include <sys/param.h> 41#include <sys/conf.h> 42#include <sys/fcntl.h> --- 345 unchanged lines hidden (view full) --- 388 389 bcopy(IFP2ENADDR(tp->tap_ifp), tp->ether_addr, sizeof(tp->ether_addr)); 390 tp->tap_pid = td->td_proc->p_pid; 391 tp->tap_flags |= TAP_OPEN; 392 ifp = tp->tap_ifp; 393 mtx_unlock(&tp->tap_mtx); 394 395 s = splimp(); | 35 * $Id: if_tap.c,v 0.21 2000/07/23 21:46:02 max Exp $ 36 */ 37 38#include "opt_inet.h" 39 40#include <sys/param.h> 41#include <sys/conf.h> 42#include <sys/fcntl.h> --- 345 unchanged lines hidden (view full) --- 388 389 bcopy(IFP2ENADDR(tp->tap_ifp), tp->ether_addr, sizeof(tp->ether_addr)); 390 tp->tap_pid = td->td_proc->p_pid; 391 tp->tap_flags |= TAP_OPEN; 392 ifp = tp->tap_ifp; 393 mtx_unlock(&tp->tap_mtx); 394 395 s = splimp(); |
396 ifp->if_flags |= IFF_RUNNING; 397 ifp->if_flags &= ~IFF_OACTIVE; | 396 ifp->if_drv_flags |= IFF_DRV_RUNNING; 397 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; |
398 splx(s); 399 400 TAPDEBUG("%s is open. minor = %#x\n", ifp->if_xname, minor(dev)); 401 402 return (0); 403} /* tapopen */ 404 405 --- 22 unchanged lines hidden (view full) --- 428 * interface, if we are in VMnet mode. just close the device. 429 */ 430 431 mtx_lock(&tp->tap_mtx); 432 if (((tp->tap_flags & TAP_VMNET) == 0) && (ifp->if_flags & IFF_UP)) { 433 mtx_unlock(&tp->tap_mtx); 434 s = splimp(); 435 if_down(ifp); | 398 splx(s); 399 400 TAPDEBUG("%s is open. minor = %#x\n", ifp->if_xname, minor(dev)); 401 402 return (0); 403} /* tapopen */ 404 405 --- 22 unchanged lines hidden (view full) --- 428 * interface, if we are in VMnet mode. just close the device. 429 */ 430 431 mtx_lock(&tp->tap_mtx); 432 if (((tp->tap_flags & TAP_VMNET) == 0) && (ifp->if_flags & IFF_UP)) { 433 mtx_unlock(&tp->tap_mtx); 434 s = splimp(); 435 if_down(ifp); |
436 if (ifp->if_flags & IFF_RUNNING) { | 436 if (ifp->if_drv_flags & IFF_DRV_RUNNING) { |
437 TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { 438 rtinit(ifa, (int)RTM_DELETE, 0); 439 } 440 if_purgeaddrs(ifp); | 437 TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { 438 rtinit(ifa, (int)RTM_DELETE, 0); 439 } 440 if_purgeaddrs(ifp); |
441 ifp->if_flags &= ~IFF_RUNNING; | 441 ifp->if_drv_flags &= ~IFF_DRV_RUNNING; |
442 } 443 splx(s); 444 } else 445 mtx_unlock(&tp->tap_mtx); 446 447 funsetown(&tp->tap_sigio); 448 selwakeuppri(&tp->tap_rsel, PZERO+1); 449 --- 18 unchanged lines hidden (view full) --- 468tapifinit(xtp) 469 void *xtp; 470{ 471 struct tap_softc *tp = (struct tap_softc *)xtp; 472 struct ifnet *ifp = tp->tap_ifp; 473 474 TAPDEBUG("initializing %s\n", ifp->if_xname); 475 | 442 } 443 splx(s); 444 } else 445 mtx_unlock(&tp->tap_mtx); 446 447 funsetown(&tp->tap_sigio); 448 selwakeuppri(&tp->tap_rsel, PZERO+1); 449 --- 18 unchanged lines hidden (view full) --- 468tapifinit(xtp) 469 void *xtp; 470{ 471 struct tap_softc *tp = (struct tap_softc *)xtp; 472 struct ifnet *ifp = tp->tap_ifp; 473 474 TAPDEBUG("initializing %s\n", ifp->if_xname); 475 |
476 ifp->if_flags |= IFF_RUNNING; 477 ifp->if_flags &= ~IFF_OACTIVE; | 476 ifp->if_drv_flags |= IFF_DRV_RUNNING; 477 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; |
478 479 /* attempt to start output */ 480 tapifstart(ifp); 481} /* tapifinit */ 482 483 484/* 485 * tapifioctl --- 79 unchanged lines hidden (view full) --- 565 } while (m != NULL); 566 splx(s); 567 568 return; 569 } 570 mtx_unlock(&tp->tap_mtx); 571 572 s = splimp(); | 478 479 /* attempt to start output */ 480 tapifstart(ifp); 481} /* tapifinit */ 482 483 484/* 485 * tapifioctl --- 79 unchanged lines hidden (view full) --- 565 } while (m != NULL); 566 splx(s); 567 568 return; 569 } 570 mtx_unlock(&tp->tap_mtx); 571 572 s = splimp(); |
573 ifp->if_flags |= IFF_OACTIVE; | 573 ifp->if_drv_flags |= IFF_DRV_OACTIVE; |
574 575 if (ifp->if_snd.ifq_len != 0) { 576 mtx_lock(&tp->tap_mtx); 577 if (tp->tap_flags & TAP_RWAIT) { 578 tp->tap_flags &= ~TAP_RWAIT; 579 wakeup(tp); 580 } 581 582 if ((tp->tap_flags & TAP_ASYNC) && (tp->tap_sigio != NULL)) { 583 mtx_unlock(&tp->tap_mtx); 584 pgsigio(&tp->tap_sigio, SIGIO, 0); 585 } else 586 mtx_unlock(&tp->tap_mtx); 587 588 selwakeuppri(&tp->tap_rsel, PZERO+1); 589 ifp->if_opackets ++; /* obytes are counted in ether_output */ 590 } 591 | 574 575 if (ifp->if_snd.ifq_len != 0) { 576 mtx_lock(&tp->tap_mtx); 577 if (tp->tap_flags & TAP_RWAIT) { 578 tp->tap_flags &= ~TAP_RWAIT; 579 wakeup(tp); 580 } 581 582 if ((tp->tap_flags & TAP_ASYNC) && (tp->tap_sigio != NULL)) { 583 mtx_unlock(&tp->tap_mtx); 584 pgsigio(&tp->tap_sigio, SIGIO, 0); 585 } else 586 mtx_unlock(&tp->tap_mtx); 587 588 selwakeuppri(&tp->tap_rsel, PZERO+1); 589 ifp->if_opackets ++; /* obytes are counted in ether_output */ 590 } 591 |
592 ifp->if_flags &= ~IFF_OACTIVE; | 592 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; |
593 splx(s); 594} /* tapifstart */ 595 596 597/* 598 * tapioctl 599 * 600 * the cdevsw interface is now pretty minimal --- 280 unchanged lines hidden --- | 593 splx(s); 594} /* tapifstart */ 595 596 597/* 598 * tapioctl 599 * 600 * the cdevsw interface is now pretty minimal --- 280 unchanged lines hidden --- |