mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 08:32:45 +00:00
Merge pull request #763 from dslicenc/ospfd-network-statement
lib/ospf/eigrp: enable ospf and eigrp to use more specific network st…
This commit is contained in:
commit
9e810aba4e
@ -262,7 +262,7 @@ static int
|
|||||||
eigrp_network_match_iface(const struct connected *co, const struct prefix *net)
|
eigrp_network_match_iface(const struct connected *co, const struct prefix *net)
|
||||||
{
|
{
|
||||||
/* new approach: more elegant and conceptually clean */
|
/* new approach: more elegant and conceptually clean */
|
||||||
return prefix_match(net, CONNECTED_PREFIX (co));
|
return prefix_match_network_statement(net, CONNECTED_PREFIX (co));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
25
lib/prefix.c
25
lib/prefix.c
@ -292,6 +292,31 @@ prefix_match (const struct prefix *n, const struct prefix *p)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If n includes p then return 1 else return 0. Prefix mask is not considered */
|
||||||
|
int
|
||||||
|
prefix_match_network_statement (const struct prefix *n, const struct prefix *p)
|
||||||
|
{
|
||||||
|
int offset;
|
||||||
|
int shift;
|
||||||
|
const u_char *np, *pp;
|
||||||
|
|
||||||
|
/* Set both prefix's head pointer. */
|
||||||
|
np = (const u_char *)&n->u.prefix;
|
||||||
|
pp = (const u_char *)&p->u.prefix;
|
||||||
|
|
||||||
|
offset = n->prefixlen / PNBBY;
|
||||||
|
shift = n->prefixlen % PNBBY;
|
||||||
|
|
||||||
|
if (shift)
|
||||||
|
if (maskbit[shift] & (np[offset] ^ pp[offset]))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
while (offset--)
|
||||||
|
if (np[offset] != pp[offset])
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Copy prefix from src to dest. */
|
/* Copy prefix from src to dest. */
|
||||||
void
|
void
|
||||||
prefix_copy (struct prefix *dest, const struct prefix *src)
|
prefix_copy (struct prefix *dest, const struct prefix *src)
|
||||||
|
@ -279,6 +279,7 @@ extern int str2prefix (const char *, struct prefix *);
|
|||||||
|
|
||||||
extern const char *prefix2str (union prefixconstptr, char *, int);
|
extern const char *prefix2str (union prefixconstptr, char *, int);
|
||||||
extern int prefix_match (const struct prefix *, const struct prefix *);
|
extern int prefix_match (const struct prefix *, const struct prefix *);
|
||||||
|
extern int prefix_match_network_statement (const struct prefix *, const struct prefix *);
|
||||||
extern int prefix_same (const struct prefix *, const struct prefix *);
|
extern int prefix_same (const struct prefix *, const struct prefix *);
|
||||||
extern int prefix_cmp (const struct prefix *, const struct prefix *);
|
extern int prefix_cmp (const struct prefix *, const struct prefix *);
|
||||||
extern int prefix_common_bits (const struct prefix *, const struct prefix *);
|
extern int prefix_common_bits (const struct prefix *, const struct prefix *);
|
||||||
|
@ -1081,7 +1081,7 @@ static int
|
|||||||
ospf_network_match_iface(const struct connected *co, const struct prefix *net)
|
ospf_network_match_iface(const struct connected *co, const struct prefix *net)
|
||||||
{
|
{
|
||||||
/* new approach: more elegant and conceptually clean */
|
/* new approach: more elegant and conceptually clean */
|
||||||
return prefix_match(net, CONNECTED_PREFIX(co));
|
return prefix_match_network_statement(net, CONNECTED_PREFIX(co));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user