fad-glifc.c (214518) | fad-glifc.c (251129) |
---|---|
1/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */ 2/* 3 * Copyright (c) 1994, 1995, 1996, 1997, 1998 4 * The Regents of the University of California. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 66 unchanged lines hidden (view full) --- 75 * The list, as returned through "alldevsp", may be null if no interfaces 76 * were up and could be opened. 77 * 78 * This is the implementation used on platforms that have SIOCGLIFCONF 79 * but don't have "getifaddrs()". (Solaris 8 and later; we use 80 * SIOCGLIFCONF rather than SIOCGIFCONF in order to get IPv6 addresses.) 81 */ 82int | 1/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */ 2/* 3 * Copyright (c) 1994, 1995, 1996, 1997, 1998 4 * The Regents of the University of California. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 66 unchanged lines hidden (view full) --- 75 * The list, as returned through "alldevsp", may be null if no interfaces 76 * were up and could be opened. 77 * 78 * This is the implementation used on platforms that have SIOCGLIFCONF 79 * but don't have "getifaddrs()". (Solaris 8 and later; we use 80 * SIOCGLIFCONF rather than SIOCGIFCONF in order to get IPv6 addresses.) 81 */ 82int |
83pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf) | 83pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) |
84{ 85 pcap_if_t *devlist = NULL; 86 register int fd4, fd6, fd; 87 register struct lifreq *ifrp, *ifend; 88 struct lifnum ifn; 89 struct lifconf ifc; 90 char *buf = NULL; 91 unsigned buf_size; --- 265 unchanged lines hidden (view full) --- 357 ret = -1; 358 break; 359 } 360 } 361 free(buf); 362 (void)close(fd6); 363 (void)close(fd4); 364 | 84{ 85 pcap_if_t *devlist = NULL; 86 register int fd4, fd6, fd; 87 register struct lifreq *ifrp, *ifend; 88 struct lifnum ifn; 89 struct lifconf ifc; 90 char *buf = NULL; 91 unsigned buf_size; --- 265 unchanged lines hidden (view full) --- 357 ret = -1; 358 break; 359 } 360 } 361 free(buf); 362 (void)close(fd6); 363 (void)close(fd4); 364 |
365 if (ret != -1) { 366 /* 367 * We haven't had any errors yet; do any platform-specific 368 * operations to add devices. 369 */ 370 if (pcap_platform_finddevs(&devlist, errbuf) < 0) 371 ret = -1; 372 } 373 | |
374 if (ret == -1) { 375 /* 376 * We had an error; free the list we've been constructing. 377 */ 378 if (devlist != NULL) { 379 pcap_freealldevs(devlist); 380 devlist = NULL; 381 } 382 } 383 384 *alldevsp = devlist; 385 return (ret); 386} | 365 if (ret == -1) { 366 /* 367 * We had an error; free the list we've been constructing. 368 */ 369 if (devlist != NULL) { 370 pcap_freealldevs(devlist); 371 devlist = NULL; 372 } 373 } 374 375 *alldevsp = devlist; 376 return (ret); 377} |