summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
Diffstat (limited to 'nest')
-rw-r--r--nest/iface.c19
-rw-r--r--nest/iface.h25
-rw-r--r--nest/neighbor.c2
3 files changed, 22 insertions, 24 deletions
diff --git a/nest/iface.c b/nest/iface.c
index 19b19ed5..3cfc626a 100644
--- a/nest/iface.c
+++ b/nest/iface.c
@@ -51,7 +51,7 @@ ifa_dump(struct ifa *a)
debug("\t%I, net %I/%-2d bc %I -> %I%s%s%s\n", a->ip, a->prefix, a->pxlen, a->brd, a->opposite,
(a->flags & IF_UP) ? "" : " DOWN",
(a->flags & IA_PRIMARY) ? "" : " SEC",
- (a->flags & IA_UNNUMBERED) ? " UNNUM" : "");
+ (a->flags & IA_PEER) ? "PEER" : "");
}
/**
@@ -474,7 +474,7 @@ ifa_update(struct ifa *a)
ipa_equal(b->brd, a->brd) &&
ipa_equal(b->opposite, a->opposite) &&
b->scope == a->scope &&
- !((b->flags ^ a->flags) & IA_UNNUMBERED))
+ !((b->flags ^ a->flags) & IA_PEER))
{
b->flags |= IF_UPDATED;
return b;
@@ -543,7 +543,7 @@ auto_router_id(void)
if ((i->flags & IF_ADMIN_UP) &&
!(i->flags & (IF_IGNORE | IF_SHUTDOWN)) &&
i->addr &&
- !(i->addr->flags & IA_UNNUMBERED) &&
+ !(i->addr->flags & IA_PEER) &&
(!j || ipa_to_u32(i->addr->ip) < ipa_to_u32(j->addr->ip)))
j = i;
if (!j)
@@ -602,7 +602,7 @@ iface_patt_match(struct iface_patt *ifp, struct iface *i, struct ifa *a)
if (ipa_in_net(a->ip, p->prefix, p->pxlen))
return pos;
- if ((a->flags & IA_UNNUMBERED) &&
+ if ((a->flags & IA_PEER) &&
ipa_in_net(a->opposite, p->prefix, p->pxlen))
return pos;
@@ -671,23 +671,16 @@ iface_patts_equal(list *a, list *b, int (*comp)(struct iface_patt *, struct ifac
static void
if_show_addr(struct ifa *a)
{
- byte broad[STD_ADDRESS_P_LENGTH + 16];
byte opp[STD_ADDRESS_P_LENGTH + 16];
- if (ipa_nonzero(a->brd))
- bsprintf(broad, ", broadcast %I", a->brd);
- else
- broad[0] = 0;
if (ipa_nonzero(a->opposite))
bsprintf(opp, ", opposite %I", a->opposite);
else
opp[0] = 0;
- cli_msg(-1003, "\t%I/%d (%s%s%s, scope %s%s)",
+ cli_msg(-1003, "\t%I/%d (%s%s, scope %s)",
a->ip, a->pxlen,
(a->flags & IA_PRIMARY) ? "Primary" : (a->flags & IA_SECONDARY) ? "Secondary" : "Unselected",
- broad, opp,
- ip_scope_text(a->scope),
- (a->flags & IA_UNNUMBERED) ? ", unnumbered" : "");
+ opp, ip_scope_text(a->scope));
}
void
diff --git a/nest/iface.h b/nest/iface.h
index 6b47a620..5906e218 100644
--- a/nest/iface.h
+++ b/nest/iface.h
@@ -51,9 +51,23 @@ struct iface {
#define IA_PRIMARY 0x10000 /* This address is primary */
#define IA_SECONDARY 0x20000 /* This address has been reported as secondary by the kernel */
-#define IA_UNNUMBERED 0x40000 /* This address belongs to an unnumbered device */
+#define IA_PEER 0x40000 /* A peer/ptp address */
+#define IA_HOST 0x80000 /* A host/loopback address */
#define IA_FLAGS 0xff0000
+/*
+ * There are three kinds of addresses in BIRD:
+ * - Standard (prefix-based) addresses, these may define ifa.opposite (for /30 or /31).
+ * - Peer/ptp addresses, without common prefix for ifa.ip and ifa.opposite.
+ * ifa.opposite is defined and ifa.prefix/pxlen == ifa.opposite/32 (for simplicity).
+ * - Host addresses, with ifa.prefix/pxlen == ifa.ip/32 (or /128).
+ * May be considered a special case of standard addresses.
+ *
+ * Peer addresses (AFAIK) do not exist in IPv6. Linux alos supports generalized peer
+ * address (with pxlen < 32 and ifa.ip outside prefix), we do not support that.
+ */
+
+
#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 */
@@ -85,15 +99,6 @@ struct iface *if_find_by_index(unsigned);
struct iface *if_find_by_name(char *);
void ifa_recalc_all_primary_addresses(void);
-static inline int
-ifa_match_addr(struct ifa *ifa, ip_addr addr)
-{
- if (ifa->flags & IA_UNNUMBERED)
- return ipa_equal(addr, ifa->opposite);
- else
- return ipa_in_net(addr, ifa->prefix, ifa->pxlen);
-}
-
/* The Neighbor Cache */
typedef struct neighbor {
diff --git a/nest/neighbor.c b/nest/neighbor.c
index 1e0780c1..1a5ac215 100644
--- a/nest/neighbor.c
+++ b/nest/neighbor.c
@@ -66,7 +66,7 @@ if_connected(ip_addr *a, struct iface *i) /* -1=error, 1=match, 0=no match */
{
if (ipa_equal(*a, b->ip))
return SCOPE_HOST;
- if (b->flags & IA_UNNUMBERED)
+ if (b->flags & IA_PEER)
{
if (ipa_equal(*a, b->opposite))
return b->scope;