c5d5f7697a
addresses. Make the kernel support SIOC[SG]IFADDRPREF for IPv6 interface addresses. In in6ifa_ifpforlinklocal(), consult preference numbers before making an otherwise arbitrary choice of in6_ifaddr. Otherwise, preference numbers are *not* consulted by the kernel, but that will be rather easy for somebody with a little bit of free time to fix. Please note that setting the preference number for a link-local IPv6 address does not work right, yet, but that ought to be fixed soon. In support of the changes above, 1 Add a method to struct domain for "externalizing" a sockaddr, and provide an implementation for IPv6. Expect more work in this area: it may be more proper to say that the IPv6 implementation "internalizes" a sockaddr. Add sockaddr_externalize(). 2 Add a subroutine, sofamily(), that returns a struct socket's address family or AF_UNSPEC. 3 Make a lot of IPv4-specific code generic, and move it from sys/netinet/ to sys/net/ for re-use by IPv6 parts of the kernel and ifconfig(8).
36 lines
1.1 KiB
C
36 lines
1.1 KiB
C
#ifndef _IFCONFIG_UTIL_H
|
|
#define _IFCONFIG_UTIL_H
|
|
|
|
#include <netinet/in.h>
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
#include <ifaddrs.h>
|
|
|
|
#include "parse.h"
|
|
|
|
struct afswtch {
|
|
const char *af_name;
|
|
short af_af;
|
|
void (*af_status)(prop_dictionary_t, prop_dictionary_t, bool);
|
|
void (*af_addr_commit)(prop_dictionary_t, prop_dictionary_t);
|
|
SIMPLEQ_ENTRY(afswtch) af_next;
|
|
};
|
|
|
|
void print_link_addresses(prop_dictionary_t, bool);
|
|
const char *get_string(const char *, const char *, u_int8_t *, int *);
|
|
const struct afswtch *lookup_af_byname(const char *);
|
|
const struct afswtch *lookup_af_bynum(int);
|
|
void print_string(const u_int8_t *, int);
|
|
int getsock(int);
|
|
struct paddr_prefix *prefixlen_to_mask(int, int);
|
|
int direct_ioctl(prop_dictionary_t, unsigned long, void *);
|
|
int indirect_ioctl(prop_dictionary_t, unsigned long, void *);
|
|
#ifdef INET6
|
|
void in6_fillscopeid(struct sockaddr_in6 *sin6);
|
|
#endif /* INET6 */
|
|
bool ifa_any_preferences(const char *, struct ifaddrs *, int);
|
|
void ifa_print_preference(const char *, const struct sockaddr *);
|
|
int16_t ifa_get_preference(const char *, const struct sockaddr *);
|
|
|
|
#endif /* _IFCONFIG_UTIL_H */
|