rip6query.c (62752) | rip6query.c (78064) |
---|---|
1/* $KAME: rip6query.c,v 1.11 2001/05/08 04:36:37 itojun Exp $ */ 2 |
|
1/* 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 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 --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 3/* 4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 * |
29 * $FreeBSD: head/usr.sbin/rip6query/rip6query.c 62752 2000-07-07 07:35:51Z kris $ | 31 * $FreeBSD: head/usr.sbin/rip6query/rip6query.c 78064 2001-06-11 12:39:29Z ume $ |
30 */ 31 32#include <stdio.h> 33 34#include <unistd.h> 35#include <stdlib.h> 36#include <string.h> 37#include <ctype.h> 38#include <signal.h> 39#include <errno.h> 40#include <err.h> 41 42#include <sys/types.h> 43#include <sys/socket.h> | 32 */ 33 34#include <stdio.h> 35 36#include <unistd.h> 37#include <stdlib.h> 38#include <string.h> 39#include <ctype.h> 40#include <signal.h> 41#include <errno.h> 42#include <err.h> 43 44#include <sys/types.h> 45#include <sys/socket.h> |
46#include <sys/queue.h> 47 |
|
44#include <net/if.h> 45#if defined(__FreeBSD__) && __FreeBSD__ >= 3 46#include <net/if_var.h> 47#endif /* __FreeBSD__ >= 3 */ 48#include <netinet/in.h> 49#include <netinet/in_var.h> 50#include <arpa/inet.h> 51#include <netdb.h> --- 25 unchanged lines hidden (view full) --- 77 struct sockaddr_in6 fsock; 78 int i, n, len, flen; 79 int c; 80 int ifidx = -1; 81 int error; 82 char pbuf[10]; 83 struct addrinfo hints, *res; 84 | 48#include <net/if.h> 49#if defined(__FreeBSD__) && __FreeBSD__ >= 3 50#include <net/if_var.h> 51#endif /* __FreeBSD__ >= 3 */ 52#include <netinet/in.h> 53#include <netinet/in_var.h> 54#include <arpa/inet.h> 55#include <netdb.h> --- 25 unchanged lines hidden (view full) --- 81 struct sockaddr_in6 fsock; 82 int i, n, len, flen; 83 int c; 84 int ifidx = -1; 85 int error; 86 char pbuf[10]; 87 struct addrinfo hints, *res; 88 |
85 while ((c = getopt(argc, argv, "I:")) != EOF) { | 89 while ((c = getopt(argc, argv, "I:")) != -1) { |
86 switch (c) { 87 case 'I': 88 ifidx = if_nametoindex(optarg); 89 if (ifidx == 0) { 90 errx(1, "invalid interface %s", optarg); 91 /*NOTREACHED*/ 92 } 93 break; 94 default: 95 usage(); 96 exit(1); 97 /*NOTREACHED*/ 98 } 99 } 100 argv += optind; 101 argc -= optind; 102 103 if (argc != 1) { 104 usage(); | 90 switch (c) { 91 case 'I': 92 ifidx = if_nametoindex(optarg); 93 if (ifidx == 0) { 94 errx(1, "invalid interface %s", optarg); 95 /*NOTREACHED*/ 96 } 97 break; 98 default: 99 usage(); 100 exit(1); 101 /*NOTREACHED*/ 102 } 103 } 104 argv += optind; 105 argc -= optind; 106 107 if (argc != 1) { 108 usage(); |
105 exit(-1); | 109 exit(1); |
106 } 107 108 if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { 109 err(1, "socket"); 110 /*NOTREACHED*/ 111 } 112 113 /* getaddrinfo is preferred for addr@ifname syntax */ --- 91 unchanged lines hidden --- | 110 } 111 112 if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { 113 err(1, "socket"); 114 /*NOTREACHED*/ 115 } 116 117 /* getaddrinfo is preferred for addr@ifname syntax */ --- 91 unchanged lines hidden --- |