NetBSD/sys/netinet/in_selsrc.h
dyoung a25eaede91 Add a source-address selection policy mechanism to the kernel.
Also, add ioctls SIOCGIFADDRPREF/SIOCSIFADDRPREF to get/set preference
numbers for addresses.  Make ifconfig(8) set/display preference
numbers.

To activate source-address selection policies in your kernel, add
'options IPSELSRC' to your kernel configuration.

Miscellaneous changes in support of source-address selection:

        1 Factor out some common code, producing rt_replace_ifa().

        2 Abbreviate a for-loop with TAILQ_FOREACH().

        3 Add the predicates on IPv4 addresses IN_LINKLOCAL() and
          IN_PRIVATE(), that are true for link-local unicast
          (169.254/16) and RFC1918 private addresses, respectively.
          Add the predicate IN_ANY_LOCAL() that is true for link-local
          unicast and multicast.

        4 Add IPv4-specific interface attach/detach routines,
          in_domifattach and in_domifdetach, which build #ifdef
          IPSELSRC.

See in_getifa(9) for a more thorough description of source-address
selection policy.
2006-11-13 05:13:38 +00:00

31 lines
669 B
C

#ifndef _NETINET_IN_SELSRC_H
#define _NETINET_IN_SELSRC_H
#define IN_SELECTSRC_LEN 128
#define IN_SCORE_SRC_MAX 8
typedef int (*in_score_src_t)(const struct in_addr *src,
int preference, int idx,
const struct in_addr *dst);
struct in_ifselsrc {
uint32_t iss_seqno;
in_score_src_t iss_score_src[IN_SCORE_SRC_MAX];
};
struct in_ifsysctl {
struct ifnet *isc_ifp;
struct sysctllog *isc_log;
struct in_ifselsrc *isc_selsrc;
};
enum in_category {
IN_CATEGORY_LINKLOCAL = 0,
IN_CATEGORY_PRIVATE,
IN_CATEGORY_OTHER
};
struct ifaddr *in_getifa(struct ifaddr *, const struct sockaddr *);
#endif /* _NETINET_IN_SELSRC_H */