ethertap.cc (12334:e0ab29a34764) | ethertap.cc (12559:55550caed7f0) |
---|---|
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 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 are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 390 unchanged lines hidden (view full) --- 399{ 400 int fd = open(p->tun_clone_device.c_str(), O_RDWR); 401 if (fd < 0) 402 panic("Couldn't open %s.\n", p->tun_clone_device); 403 404 struct ifreq ifr; 405 memset(&ifr, 0, sizeof(ifr)); 406 ifr.ifr_flags = IFF_TAP | IFF_NO_PI; | 1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 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 are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 390 unchanged lines hidden (view full) --- 399{ 400 int fd = open(p->tun_clone_device.c_str(), O_RDWR); 401 if (fd < 0) 402 panic("Couldn't open %s.\n", p->tun_clone_device); 403 404 struct ifreq ifr; 405 memset(&ifr, 0, sizeof(ifr)); 406 ifr.ifr_flags = IFF_TAP | IFF_NO_PI; |
407 strncpy(ifr.ifr_name, p->tap_device_name.c_str(), IFNAMSIZ); | 407 strncpy(ifr.ifr_name, p->tap_device_name.c_str(), IFNAMSIZ - 1); |
408 409 if (ioctl(fd, TUNSETIFF, (void *)&ifr) < 0) 410 panic("Failed to access tap device %s.\n", ifr.ifr_name); 411 // fd now refers to the tap device. 412 tap = fd; 413 pollFd(tap); 414} 415 --- 44 unchanged lines hidden --- | 408 409 if (ioctl(fd, TUNSETIFF, (void *)&ifr) < 0) 410 panic("Failed to access tap device %s.\n", ifr.ifr_name); 411 // fd now refers to the tap device. 412 tap = fd; 413 pollFd(tap); 414} 415 --- 44 unchanged lines hidden --- |