diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-12-07 13:06:01 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-12-07 13:06:01 +0100 |
commit | 153f02da3bce1f3f1a99295648679c71327e8319 (patch) | |
tree | b7b7acf8026ba182f3a81f2d6da975b0b1524972 /nest/iface.h | |
parent | 4ae3ee1200b386219673c2168eae996c6207b077 (diff) |
Nest: Maintain separate IPv4, IPv6 and LLv6 preferred addresses
Also redesign preferred address selection and update protocols to use
appropriate preferred address.
Based on a previous work by Jan Maria Matejka.
Diffstat (limited to 'nest/iface.h')
-rw-r--r-- | nest/iface.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/nest/iface.h b/nest/iface.h index de5070d6..59b1253c 100644 --- a/nest/iface.h +++ b/nest/iface.h @@ -35,11 +35,14 @@ struct iface { unsigned mtu; unsigned index; /* OS-dependent interface index */ list addrs; /* Addresses assigned to this interface */ - struct ifa *addr; /* Primary address */ + struct ifa *addr4; /* Primary address for IPv4 */ + struct ifa *addr6; /* Primary address for IPv6 */ + struct ifa *llv6; /* Primary link-local address for IPv6 */ + ip4_addr sysdep; /* Arbitrary IPv4 address for internal sysdep use */ list neighbors; /* All neighbors on this interface */ }; -#define IF_UP 1 /* IF_ADMIN_UP and IP address known */ +#define IF_UP 1 /* Currently just IF_ADMIN_UP */ #define IF_MULTIACCESS 2 #define IF_BROADCAST 4 #define IF_MULTICAST 8 @@ -70,7 +73,10 @@ struct iface { #define IF_JUST_CREATED 0x10000000 /* Send creation event as soon as possible */ #define IF_TMP_DOWN 0x20000000 /* Temporary shutdown due to interface reconfiguration */ -#define IF_UPDATED 0x40000000 /* Touched in last scan */ +#define IF_UPDATED 0x40000000 /* Iface touched in last scan */ +#define IF_NEEDS_RECALC 0x80000000 /* Preferred address recalculation is needed */ + +#define IA_UPDATED IF_UPDATED /* Address touched in last scan */ /* Interface change events */ @@ -79,8 +85,14 @@ struct iface { #define IF_CHANGE_MTU 4 #define IF_CHANGE_CREATE 8 /* Seen this interface for the first time */ #define IF_CHANGE_LINK 0x10 +#define IF_CHANGE_ADDR4 0x100 /* Change of iface->addr4 */ +#define IF_CHANGE_ADDR6 0x200 /* ... */ +#define IF_CHANGE_LLV6 0x400 +#define IF_CHANGE_SYSDEP 0x800 #define IF_CHANGE_TOO_MUCH 0x40000000 /* Used internally */ +#define IF_CHANGE_PREFERRED (IF_CHANGE_ADDR4 | IF_CHANGE_ADDR6 | IF_CHANGE_LLV6) + void if_init(void); void if_dump(struct iface *); void if_dump_all(void); @@ -99,7 +111,7 @@ void if_feed_baby(struct proto *); struct iface *if_find_by_index(unsigned); struct iface *if_find_by_name(char *); struct iface *if_get_by_name(char *); -void ifa_recalc_all_primary_addresses(void); +void if_recalc_all_preferred_addresses(void); /* The Neighbor Cache */ |