FreeBSD Bugzilla – Attachment 188889 Details for
Bug 224079
java/openjdk8: Elasticsearch won't start after OpenJDK upgrade
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Program to demonstrate getifaddr(3) behavior
gifa.c (text/plain), 2.92 KB, created by
John W. O'Brien
on 2017-12-16 19:34:37 UTC
(
hide
)
Description:
Program to demonstrate getifaddr(3) behavior
Filename:
MIME Type:
Creator:
John W. O'Brien
Created:
2017-12-16 19:34:37 UTC
Size:
2.92 KB
patch
obsolete
>/* >Copyright 2017 John W. O'Brien <john@saltant.com> > >Redistribution and use in source and binary forms, with or without >modification, are permitted provided that the following conditions are >met: > >1. Redistributions of source code must retain the above copyright >notice, this list of conditions and the following disclaimer. > >2. Redistributions in binary form must reproduce the above copyright >notice, this list of conditions and the following disclaimer in the >documentation and/or other materials provided with the distribution. > >THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS >IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED >TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A >PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED >TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF >LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING >NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS >SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >*/ > >#include <stdio.h> >#include <ifaddrs.h> >#include <sys/types.h> >#include <sys/socket.h> >#include <netinet/in.h> >#include <arpa/inet.h> >#include <net/if.h> >#include <string.h> > >/* > This program is intended to demonstrate that the inet6 scope ID > should only be set to the interface index ID when the address > is a scoped address. > > Usage: gifa [<iface>] >*/ > >int >main(int argc, char *argv[]) { > struct ifaddrs *ifap, *cur; > char addr[INET6_ADDRSTRLEN]; > void *ia; > int have_scope; > uint32_t scope; > > getifaddrs(&ifap); > printf("%-5s %-10s %3s %-*s %5s %5s\n", > "iface", "flags", "af", INET6_ADDRSTRLEN, > "addr", "scope", "ifidx" > ); > > for (cur = ifap; NULL != cur; cur = cur->ifa_next) { > > if (argc > 1 && strncmp(cur->ifa_name, argv[1], IFNAMSIZ)) > continue; > > ia = NULL; > addr[0] = '\0'; > have_scope = 0; > > if (cur->ifa_addr->sa_family == AF_INET) { > ia = &((struct sockaddr_in *)cur->ifa_addr)->sin_addr; > } > else if (cur->ifa_addr->sa_family == AF_INET6) { > ia = &((struct sockaddr_in6 *)cur->ifa_addr)->sin6_addr; > scope = ((struct sockaddr_in6 *)cur->ifa_addr)->sin6_scope_id; > have_scope = 1; > } > > if (ia) > inet_ntop(cur->ifa_addr->sa_family, > ia, addr, INET6_ADDRSTRLEN); > > printf("%-5s 0x%08x %3d %-*s %5d %5d\n", > cur->ifa_name, > cur->ifa_flags, > cur->ifa_addr->sa_family, > INET6_ADDRSTRLEN, > addr, > have_scope ? scope : -1, > if_nametoindex(cur->ifa_name) > ); > } > freeifaddrs(ifap); > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 224079
:
188887
|
188888
| 188889 |
188890