Deleted Added
full compact
rip6query.c (95258) rip6query.c (146187)
1/* $KAME: rip6query.c,v 1.11 2001/05/08 04:36:37 itojun Exp $ */
2
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

--- 14 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 *
1/* $KAME: rip6query.c,v 1.11 2001/05/08 04:36:37 itojun Exp $ */
2
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

--- 14 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 *
31 * $FreeBSD: head/usr.sbin/rip6query/rip6query.c 95258 2002-04-22 13:44:47Z des $
31 * $FreeBSD: head/usr.sbin/rip6query/rip6query.c 146187 2005-05-13 16:31:11Z ume $
32 */
33
34#include <stdio.h>
35
36#include <unistd.h>
37#include <stdlib.h>
38#include <string.h>
39#include <ctype.h>

--- 11 unchanged lines hidden (view full) ---

51#endif /* __FreeBSD__ >= 3 */
52#include <netinet/in.h>
53#include <netinet/in_var.h>
54#include <arpa/inet.h>
55#include <netdb.h>
56
57#include "route6d.h"
58
32 */
33
34#include <stdio.h>
35
36#include <unistd.h>
37#include <stdlib.h>
38#include <string.h>
39#include <ctype.h>

--- 11 unchanged lines hidden (view full) ---

51#endif /* __FreeBSD__ >= 3 */
52#include <netinet/in.h>
53#include <netinet/in_var.h>
54#include <arpa/inet.h>
55#include <netdb.h>
56
57#include "route6d.h"
58
59/* wrapper for KAME-special getnameinfo() */
60#ifndef NI_WITHSCOPEID
61#define NI_WITHSCOPEID 0
62#endif
63
64int s;
65struct sockaddr_in6 sin6;
66struct rip6 *ripbuf;
67
68#define RIPSIZE(n) (sizeof(struct rip6) + (n-1) * sizeof(struct netinfo6))
69
70int main __P((int, char **));
71static void usage __P((void));

--- 115 unchanged lines hidden (view full) ---

187/* getnameinfo() is preferred as we may be able to show ifindex as ifname */
188static const char *
189sa_n2a(sa)
190 struct sockaddr *sa;
191{
192 static char buf[NI_MAXHOST];
193
194 if (getnameinfo(sa, sa->sa_len, buf, sizeof(buf),
59int s;
60struct sockaddr_in6 sin6;
61struct rip6 *ripbuf;
62
63#define RIPSIZE(n) (sizeof(struct rip6) + (n-1) * sizeof(struct netinfo6))
64
65int main __P((int, char **));
66static void usage __P((void));

--- 115 unchanged lines hidden (view full) ---

182/* getnameinfo() is preferred as we may be able to show ifindex as ifname */
183static const char *
184sa_n2a(sa)
185 struct sockaddr *sa;
186{
187 static char buf[NI_MAXHOST];
188
189 if (getnameinfo(sa, sa->sa_len, buf, sizeof(buf),
195 NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID) != 0) {
190 NULL, 0, NI_NUMERICHOST) != 0) {
196 snprintf(buf, sizeof(buf), "%s", "(invalid)");
197 }
198 return buf;
199}
200
201static const char *
202inet6_n2a(addr)
203 struct in6_addr *addr;
204{
205 static char buf[NI_MAXHOST];
206
207 return inet_ntop(AF_INET6, addr, buf, sizeof(buf));
208}
191 snprintf(buf, sizeof(buf), "%s", "(invalid)");
192 }
193 return buf;
194}
195
196static const char *
197inet6_n2a(addr)
198 struct in6_addr *addr;
199{
200 static char buf[NI_MAXHOST];
201
202 return inet_ntop(AF_INET6, addr, buf, sizeof(buf));
203}