ether.c (62209) | ether.c (66898) |
---|---|
1/*- 2 * Copyright (c) 1999 Brian Somers <brian@Awfulhak.org> 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1999 Brian Somers <brian@Awfulhak.org> 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/usr.sbin/ppp/ether.c 62209 2000-06-28 09:30:30Z brian $ | 26 * $FreeBSD: head/usr.sbin/ppp/ether.c 66898 2000-10-09 21:18:23Z brian $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/socket.h> 31#include <sys/un.h> 32#include <netinet/in.h> 33#include <arpa/inet.h> 34#include <netdb.h> --- 163 unchanged lines hidden (view full) --- 198ether_MessageIn(struct etherdevice *dev) 199{ 200 char msgbuf[sizeof(struct ng_mesg) + sizeof(struct ngpppoe_sts)]; 201 struct ng_mesg *rep = (struct ng_mesg *)msgbuf; 202 struct ngpppoe_sts *sts = (struct ngpppoe_sts *)(msgbuf + sizeof *rep); 203 char unknown[14]; 204 const char *msg; 205 struct timeval t; | 27 */ 28 29#include <sys/param.h> 30#include <sys/socket.h> 31#include <sys/un.h> 32#include <netinet/in.h> 33#include <arpa/inet.h> 34#include <netdb.h> --- 163 unchanged lines hidden (view full) --- 198ether_MessageIn(struct etherdevice *dev) 199{ 200 char msgbuf[sizeof(struct ng_mesg) + sizeof(struct ngpppoe_sts)]; 201 struct ng_mesg *rep = (struct ng_mesg *)msgbuf; 202 struct ngpppoe_sts *sts = (struct ngpppoe_sts *)(msgbuf + sizeof *rep); 203 char unknown[14]; 204 const char *msg; 205 struct timeval t; |
206 fd_set r; | 206 fd_set *r; 207 int ret; |
207 208 if (dev->cs < 0) 209 return; 210 | 208 209 if (dev->cs < 0) 210 return; 211 |
211 FD_ZERO(&r); 212 FD_SET(dev->cs, &r); | 212 if ((r = mkfdset()) == NULL) { 213 log_Printf(LogERROR, "DoLoop: Cannot create fd_set\n"); 214 return; 215 } 216 zerofdset(r); 217 FD_SET(dev->cs, r); |
213 t.tv_sec = t.tv_usec = 0; | 218 t.tv_sec = t.tv_usec = 0; |
214 if (select(dev->cs + 1, &r, NULL, NULL, &t) <= 0) | 219 ret = select(dev->cs + 1, r, NULL, NULL, &t); 220 free(r); 221 222 if (ret <= 0) |
215 return; 216 217 if (NgRecvMsg(dev->cs, rep, sizeof msgbuf, NULL) < 0) 218 return; 219 220 if (rep->header.version != NG_VERSION) { 221 log_Printf(LogWARN, "%ld: Unexpected netgraph version, expected %ld\n", 222 (long)rep->header.version, (long)NG_VERSION); --- 440 unchanged lines hidden --- | 223 return; 224 225 if (NgRecvMsg(dev->cs, rep, sizeof msgbuf, NULL) < 0) 226 return; 227 228 if (rep->header.version != NG_VERSION) { 229 log_Printf(LogWARN, "%ld: Unexpected netgraph version, expected %ld\n", 230 (long)rep->header.version, (long)NG_VERSION); --- 440 unchanged lines hidden --- |