fad-getad.c (127664) | fad-getad.c (146768) |
---|---|
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: --- 20 unchanged lines hidden (view full) --- 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 */ 34 35#ifndef lint 36static const char rcsid[] _U_ = | 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: --- 20 unchanged lines hidden (view full) --- 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 */ 34 35#ifndef lint 36static const char rcsid[] _U_ = |
37 "@(#) $Header: /tcpdump/master/libpcap/fad-getad.c,v 1.7.2.2 2004/03/11 23:04:52 guy Exp $ (LBL)"; | 37 "@(#) $Header: /tcpdump/master/libpcap/fad-getad.c,v 1.10 2004/11/04 07:26:04 guy Exp $ (LBL)"; |
38#endif 39 40#ifdef HAVE_CONFIG_H 41#include "config.h" 42#endif 43 44#include <sys/types.h> 45#include <sys/socket.h> --- 7 unchanged lines hidden (view full) --- 53#include <ifaddrs.h> 54 55#include "pcap-int.h" 56 57#ifdef HAVE_OS_PROTO_H 58#include "os-proto.h" 59#endif 60 | 38#endif 39 40#ifdef HAVE_CONFIG_H 41#include "config.h" 42#endif 43 44#include <sys/types.h> 45#include <sys/socket.h> --- 7 unchanged lines hidden (view full) --- 53#include <ifaddrs.h> 54 55#include "pcap-int.h" 56 57#ifdef HAVE_OS_PROTO_H 58#include "os-proto.h" 59#endif 60 |
61#ifdef AF_PACKET 62# include <linux/if_packet.h> 63#endif 64 |
|
61/* 62 * This is fun. 63 * 64 * In older BSD systems, socket addresses were fixed-length, and 65 * "sizeof (struct sockaddr)" gave the size of the structure. 66 * All addresses fit within a "struct sockaddr". 67 * 68 * In newer BSD systems, the socket address is variable-length, and --- 27 unchanged lines hidden (view full) --- 96 return (sizeof (struct sockaddr_in)); 97#endif 98 99#ifdef AF_INET6 100 case AF_INET6: 101 return (sizeof (struct sockaddr_in6)); 102#endif 103 | 65/* 66 * This is fun. 67 * 68 * In older BSD systems, socket addresses were fixed-length, and 69 * "sizeof (struct sockaddr)" gave the size of the structure. 70 * All addresses fit within a "struct sockaddr". 71 * 72 * In newer BSD systems, the socket address is variable-length, and --- 27 unchanged lines hidden (view full) --- 100 return (sizeof (struct sockaddr_in)); 101#endif 102 103#ifdef AF_INET6 104 case AF_INET6: 105 return (sizeof (struct sockaddr_in6)); 106#endif 107 |
108#ifdef AF_PACKET 109 case AF_PACKET: 110 return (sizeof (struct sockaddr_ll)); 111#endif 112 |
|
104 default: 105 return (sizeof (struct sockaddr)); 106 } 107} 108#define SA_LEN(addr) (get_sa_len(addr)) 109#else /* HAVE_SOCKADDR_STORAGE */ 110#define SA_LEN(addr) (sizeof (struct sockaddr)) 111#endif /* HAVE_SOCKADDR_STORAGE */ --- 132 unchanged lines hidden --- | 113 default: 114 return (sizeof (struct sockaddr)); 115 } 116} 117#define SA_LEN(addr) (get_sa_len(addr)) 118#else /* HAVE_SOCKADDR_STORAGE */ 119#define SA_LEN(addr) (sizeof (struct sockaddr)) 120#endif /* HAVE_SOCKADDR_STORAGE */ --- 132 unchanged lines hidden --- |