[ipv6] Separate the concepts of prefix and address creation

Allow for IPv6 routing table entries to be created for an on-link
prefix where a local address has not yet been assigned to the network
device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2013-11-15 15:12:25 +00:00
parent 3f9a482b88
commit 6b1eee0452
4 changed files with 206 additions and 129 deletions

View File

@@ -160,16 +160,24 @@ struct ipv6_miniroute {
/** Network device */
struct net_device *netdev;
/** IPv6 address */
/** IPv6 address (or prefix if no address is defined) */
struct in6_addr address;
/** Prefix length */
unsigned int prefix_len;
/** IPv6 prefix mask (derived from prefix length) */
struct in6_addr prefix_mask;
/** Router address is present */
int has_router;
/** Router address */
struct in6_addr router;
/** Flags */
unsigned int flags;
};
/** IPv6 address/routing table entry flags */
enum ipv6_miniroute_flags {
/** Routing table entry address is valid */
IPV6_HAS_ADDRESS = 0x0001,
/** Routing table entry router address is valid */
IPV6_HAS_ROUTER = 0x0002,
};
/**
@@ -235,7 +243,9 @@ extern struct list_head ipv6_miniroutes;
extern struct net_protocol ipv6_protocol __net_protocol;
extern int ipv6_has_addr ( struct net_device *netdev, struct in6_addr *addr );
extern int ipv6_slaac ( struct net_device *netdev, struct in6_addr *prefix,
unsigned int prefix_len, struct in6_addr *router );
extern int ipv6_set_prefix ( struct net_device *netdev, struct in6_addr *prefix,
unsigned int prefix_len, struct in6_addr *router );
extern int ipv6_set_address ( struct net_device *netdev,
struct in6_addr *address );
#endif /* _IPXE_IPV6_H */