if_tap.c (167713) | if_tap.c (178221) |
---|---|
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 167713 2007-03-19 18:17:31Z bms $ | 34 * $FreeBSD: head/sys/net/if_tap.c 178221 2008-04-15 16:54:39Z emax $ |
35 * $Id: if_tap.c,v 0.21 2000/07/23 21:46:02 max Exp $ 36 */ 37 38#include "opt_compat.h" 39#include "opt_inet.h" 40 41#include <sys/param.h> 42#include <sys/conf.h> --- 356 unchanged lines hidden (view full) --- 399 * to create interface 400 */ 401static void 402tapcreate(struct cdev *dev) 403{ 404 struct ifnet *ifp = NULL; 405 struct tap_softc *tp = NULL; 406 unsigned short macaddr_hi; | 35 * $Id: if_tap.c,v 0.21 2000/07/23 21:46:02 max Exp $ 36 */ 37 38#include "opt_compat.h" 39#include "opt_inet.h" 40 41#include <sys/param.h> 42#include <sys/conf.h> --- 356 unchanged lines hidden (view full) --- 399 * to create interface 400 */ 401static void 402tapcreate(struct cdev *dev) 403{ 404 struct ifnet *ifp = NULL; 405 struct tap_softc *tp = NULL; 406 unsigned short macaddr_hi; |
407 uint32_t macaddr_mid; |
|
407 int unit, s; 408 char *name = NULL; 409 u_char eaddr[6]; 410 411 dev->si_flags &= ~SI_CHEAPCLONE; 412 413 /* allocate driver storage and create device */ 414 MALLOC(tp, struct tap_softc *, sizeof(*tp), M_TAP, M_WAITOK | M_ZERO); --- 12 unchanged lines hidden (view full) --- 427 name = TAP; 428 429 unit &= TAPMAXUNIT; 430 431 TAPDEBUG("tapcreate(%s%d). minor = %#x\n", name, unit, minor(dev)); 432 433 /* generate fake MAC address: 00 bd xx xx xx unit_no */ 434 macaddr_hi = htons(0x00bd); | 408 int unit, s; 409 char *name = NULL; 410 u_char eaddr[6]; 411 412 dev->si_flags &= ~SI_CHEAPCLONE; 413 414 /* allocate driver storage and create device */ 415 MALLOC(tp, struct tap_softc *, sizeof(*tp), M_TAP, M_WAITOK | M_ZERO); --- 12 unchanged lines hidden (view full) --- 428 name = TAP; 429 430 unit &= TAPMAXUNIT; 431 432 TAPDEBUG("tapcreate(%s%d). minor = %#x\n", name, unit, minor(dev)); 433 434 /* generate fake MAC address: 00 bd xx xx xx unit_no */ 435 macaddr_hi = htons(0x00bd); |
436 macaddr_mid = (uint32_t) ticks; |
|
435 bcopy(&macaddr_hi, eaddr, sizeof(short)); | 437 bcopy(&macaddr_hi, eaddr, sizeof(short)); |
436 bcopy(&ticks, &eaddr[2], sizeof(long)); | 438 bcopy(&macaddr_mid, &eaddr[2], sizeof(uint32_t)); |
437 eaddr[5] = (u_char)unit; 438 439 /* fill the rest and attach interface */ 440 ifp = tp->tap_ifp = if_alloc(IFT_ETHER); 441 if (ifp == NULL) 442 panic("%s%d: can not if_alloc()", name, unit); 443 ifp->if_softc = tp; 444 if_initname(ifp, name, unit); --- 658 unchanged lines hidden --- | 439 eaddr[5] = (u_char)unit; 440 441 /* fill the rest and attach interface */ 442 ifp = tp->tap_ifp = if_alloc(IFT_ETHER); 443 if (ifp == NULL) 444 panic("%s%d: can not if_alloc()", name, unit); 445 ifp->if_softc = tp; 446 if_initname(ifp, name, unit); --- 658 unchanged lines hidden --- |