diff options
Diffstat (limited to 'lib/if.h')
-rw-r--r-- | lib/if.h | 34 |
1 files changed, 23 insertions, 11 deletions
@@ -154,26 +154,38 @@ struct connected /* Flags for connected address. */ u_char flags; -#define ZEBRA_IFA_SECONDARY (1 << 0) +#define ZEBRA_IFA_SECONDARY (1 << 0) +#define ZEBRA_IFA_PEER (1 << 1) + /* N.B. the ZEBRA_IFA_PEER flag should be set if and only if + a peer address has been configured. If this flag is set, + the destination field must contain the peer address. + Otherwise, if this flag is not set, the destination address + will either contain a broadcast address or be NULL. + */ /* Address of connected network. */ struct prefix *address; - struct prefix *destination; /* broadcast or peer address; may be NULL */ + + /* Peer or Broadcast address, depending on whether ZEBRA_IFA_PEER is set. + Note: destination may be NULL if ZEBRA_IFA_PEER is not set. */ + struct prefix *destination; /* Label for Linux 2.2.X and upper. */ char *label; }; -/* Given an IPV4 struct connected, this macro determines whether a /32 - peer address has been supplied (i.e. there is no subnet assigned) */ -#define CONNECTED_DEST_HOST(C) \ - ((C)->destination && ((C)->address->prefixlen == IPV4_MAX_PREFIXLEN)) +/* Does the destination field contain a peer address? */ +#define CONNECTED_PEER(C) CHECK_FLAG((C)->flags, ZEBRA_IFA_PEER) + +/* Prefix to insert into the RIB */ +#define CONNECTED_PREFIX(C) \ + (CONNECTED_PEER(C) ? (C)->destination : (C)->address) -/* Given an IPV4 struct connected, this macro determins whether it is - a point-to-point link with a /32 peer address (i.e. there - is no dedicated subnet for the PtP link) */ -#define CONNECTED_POINTOPOINT_HOST(C) \ - (((C)->ifp->flags & IFF_POINTOPOINT) && CONNECTED_DEST_HOST(C)) +/* Identifying address. We guess that if there's a peer address, but the + local address is in the same prefix, then the local address may be unique. */ +#define CONNECTED_ID(C) \ + ((CONNECTED_PEER(C) && !prefix_match((C)->destination, (C)->address)) ?\ + (C)->destination : (C)->address) /* Interface hook sort. */ #define IF_NEW_HOOK 0 |