mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 22:26:14 +00:00
eigrpd: Refactor eigrp_topoloy_table_lookup_ipv4
Allow eigrp_topology_table_lookup_ipv4 to use 'struct prefix' Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
836aad7ee8
commit
476a146963
@ -296,7 +296,7 @@ int eigrp_if_up(struct eigrp_interface *ei)
|
||||
dest_addr.prefixlen = ei->connected->address->prefixlen;
|
||||
apply_mask(&dest_addr);
|
||||
pe = eigrp_topology_table_lookup_ipv4(eigrp->topology_table,
|
||||
(struct prefix_ipv4 *)&dest_addr);
|
||||
&dest_addr);
|
||||
|
||||
if (pe == NULL) {
|
||||
pe = eigrp_prefix_entry_new();
|
||||
@ -430,7 +430,7 @@ u_char eigrp_default_iftype(struct interface *ifp)
|
||||
|
||||
void eigrp_if_free(struct eigrp_interface *ei, int source)
|
||||
{
|
||||
struct prefix_ipv4 dest_addr;
|
||||
struct prefix dest_addr;
|
||||
struct eigrp_prefix_entry *pe;
|
||||
struct eigrp *eigrp = eigrp_lookup();
|
||||
|
||||
@ -439,10 +439,8 @@ void eigrp_if_free(struct eigrp_interface *ei, int source)
|
||||
eigrp_hello_send(ei, EIGRP_HELLO_GRACEFUL_SHUTDOWN, NULL);
|
||||
}
|
||||
|
||||
dest_addr.family = AF_INET;
|
||||
dest_addr.prefix = ei->connected->address->u.prefix4;
|
||||
dest_addr.prefixlen = ei->connected->address->prefixlen;
|
||||
apply_mask_ipv4(&dest_addr);
|
||||
dest_addr = *ei->connected->address;
|
||||
apply_mask(&dest_addr);
|
||||
pe = eigrp_topology_table_lookup_ipv4(eigrp->topology_table,
|
||||
&dest_addr);
|
||||
if (pe)
|
||||
|
@ -91,7 +91,7 @@ void eigrp_query_receive(struct eigrp *eigrp, struct ip *iph,
|
||||
{
|
||||
struct eigrp_neighbor *nbr;
|
||||
struct TLV_IPv4_Internal_type *tlv;
|
||||
struct prefix_ipv4 dest_addr;
|
||||
struct prefix dest_addr;
|
||||
|
||||
u_int16_t type;
|
||||
u_int16_t length;
|
||||
@ -116,7 +116,7 @@ void eigrp_query_receive(struct eigrp *eigrp, struct ip *iph,
|
||||
tlv = eigrp_read_ipv4_tlv(s);
|
||||
|
||||
dest_addr.family = AF_INET;
|
||||
dest_addr.prefix = tlv->destination;
|
||||
dest_addr.u.prefix4 = tlv->destination;
|
||||
dest_addr.prefixlen = tlv->prefix_length;
|
||||
struct eigrp_prefix_entry *dest =
|
||||
eigrp_topology_table_lookup_ipv4(
|
||||
|
@ -179,14 +179,14 @@ void eigrp_reply_receive(struct eigrp *eigrp, struct ip *iph,
|
||||
while (s->endp > s->getp) {
|
||||
type = stream_getw(s);
|
||||
if (type == EIGRP_TLV_IPv4_INT) {
|
||||
struct prefix_ipv4 dest_addr;
|
||||
struct prefix dest_addr;
|
||||
|
||||
stream_set_getp(s, s->getp - sizeof(u_int16_t));
|
||||
|
||||
tlv = eigrp_read_ipv4_tlv(s);
|
||||
|
||||
dest_addr.family = AF_INET;
|
||||
dest_addr.prefix = tlv->destination;
|
||||
dest_addr.u.prefix4 = tlv->destination;
|
||||
dest_addr.prefixlen = tlv->prefix_length;
|
||||
struct eigrp_prefix_entry *dest =
|
||||
eigrp_topology_table_lookup_ipv4(
|
||||
|
@ -78,14 +78,14 @@ void eigrp_siaquery_receive(struct eigrp *eigrp, struct ip *iph,
|
||||
while (s->endp > s->getp) {
|
||||
type = stream_getw(s);
|
||||
if (type == EIGRP_TLV_IPv4_INT) {
|
||||
struct prefix_ipv4 dest_addr;
|
||||
struct prefix dest_addr;
|
||||
|
||||
stream_set_getp(s, s->getp - sizeof(u_int16_t));
|
||||
|
||||
tlv = eigrp_read_ipv4_tlv(s);
|
||||
|
||||
dest_addr.family = AFI_IP;
|
||||
dest_addr.prefix = tlv->destination;
|
||||
dest_addr.u.prefix4 = tlv->destination;
|
||||
dest_addr.prefixlen = tlv->prefix_length;
|
||||
struct eigrp_prefix_entry *dest =
|
||||
eigrp_topology_table_lookup_ipv4(
|
||||
|
@ -77,14 +77,14 @@ void eigrp_siareply_receive(struct eigrp *eigrp, struct ip *iph,
|
||||
while (s->endp > s->getp) {
|
||||
type = stream_getw(s);
|
||||
if (type == EIGRP_TLV_IPv4_INT) {
|
||||
struct prefix_ipv4 dest_addr;
|
||||
struct prefix dest_addr;
|
||||
|
||||
stream_set_getp(s, s->getp - sizeof(u_int16_t));
|
||||
|
||||
tlv = eigrp_read_ipv4_tlv(s);
|
||||
|
||||
dest_addr.family = AFI_IP;
|
||||
dest_addr.prefix = tlv->destination;
|
||||
dest_addr.u.prefix4 = tlv->destination;
|
||||
dest_addr.prefixlen = tlv->prefix_length;
|
||||
struct eigrp_prefix_entry *dest =
|
||||
eigrp_topology_table_lookup_ipv4(
|
||||
|
@ -261,13 +261,12 @@ unsigned int eigrp_topology_table_isempty(struct list *topology)
|
||||
|
||||
struct eigrp_prefix_entry *
|
||||
eigrp_topology_table_lookup_ipv4(struct list *topology_table,
|
||||
struct prefix_ipv4 *address)
|
||||
struct prefix *address)
|
||||
{
|
||||
struct eigrp_prefix_entry *data;
|
||||
struct listnode *node;
|
||||
for (ALL_LIST_ELEMENTS_RO(topology_table, node, data)) {
|
||||
if (prefix_same(data->destination,
|
||||
(struct prefix *)address))
|
||||
if (prefix_same(data->destination, address))
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ extern void eigrp_neighbor_entry_delete(struct eigrp_prefix_entry *,
|
||||
extern void eigrp_topology_delete_all(struct list *);
|
||||
extern unsigned int eigrp_topology_table_isempty(struct list *);
|
||||
extern struct eigrp_prefix_entry *
|
||||
eigrp_topology_table_lookup_ipv4(struct list *, struct prefix_ipv4 *);
|
||||
eigrp_topology_table_lookup_ipv4(struct list *, struct prefix *);
|
||||
extern struct list *eigrp_topology_get_successor(struct eigrp_prefix_entry *);
|
||||
extern struct list *
|
||||
eigrp_topology_get_successor_max(struct eigrp_prefix_entry *pe,
|
||||
|
@ -157,7 +157,7 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph,
|
||||
u_char same;
|
||||
struct access_list *alist;
|
||||
struct prefix_list *plist;
|
||||
struct prefix_ipv4 dest_addr;
|
||||
struct prefix dest_addr;
|
||||
struct eigrp *e;
|
||||
u_char graceful_restart;
|
||||
u_char graceful_restart_final;
|
||||
@ -281,7 +281,7 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph,
|
||||
|
||||
/*searching if destination exists */
|
||||
dest_addr.family = AF_INET;
|
||||
dest_addr.prefix = tlv->destination;
|
||||
dest_addr.u.prefix4 = tlv->destination;
|
||||
dest_addr.prefixlen = tlv->prefix_length;
|
||||
struct eigrp_prefix_entry *dest =
|
||||
eigrp_topology_table_lookup_ipv4(
|
||||
@ -314,7 +314,7 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph,
|
||||
pe->serno = eigrp->serno;
|
||||
pe->destination = (struct prefix *)prefix_ipv4_new();
|
||||
prefix_copy(pe->destination,
|
||||
(struct prefix *)&dest_addr);
|
||||
&dest_addr);
|
||||
pe->af = AF_INET;
|
||||
pe->state = EIGRP_FSM_STATE_PASSIVE;
|
||||
pe->nt = EIGRP_TOPOLOGY_TYPE_REMOTE;
|
||||
@ -338,9 +338,8 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph,
|
||||
|
||||
/* Check if access-list fits */
|
||||
if (alist
|
||||
&& access_list_apply(
|
||||
alist,
|
||||
(struct prefix *)&dest_addr)
|
||||
&& access_list_apply(alist,
|
||||
&dest_addr)
|
||||
== FILTER_DENY) {
|
||||
/* If yes, set reported metric to Max */
|
||||
ne->reported_metric.delay =
|
||||
@ -355,9 +354,8 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph,
|
||||
|
||||
/* Check if prefix-list fits */
|
||||
if (plist
|
||||
&& prefix_list_apply(
|
||||
plist,
|
||||
(struct prefix *)&dest_addr)
|
||||
&& prefix_list_apply(plist,
|
||||
&dest_addr)
|
||||
== PREFIX_DENY) {
|
||||
/* If yes, set reported metric to Max */
|
||||
ne->reported_metric.delay =
|
||||
@ -369,9 +367,8 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph,
|
||||
|
||||
/* Check if access-list fits */
|
||||
if (alist
|
||||
&& access_list_apply(
|
||||
alist,
|
||||
(struct prefix *)&dest_addr)
|
||||
&& access_list_apply(alist,
|
||||
&dest_addr)
|
||||
== FILTER_DENY) {
|
||||
/* If yes, set reported metric to Max */
|
||||
ne->reported_metric.delay =
|
||||
@ -382,9 +379,8 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph,
|
||||
|
||||
/* Check if prefix-list fits */
|
||||
if (plist
|
||||
&& prefix_list_apply(
|
||||
plist,
|
||||
(struct prefix *)&dest_addr)
|
||||
&& prefix_list_apply(plist,
|
||||
&dest_addr)
|
||||
== PREFIX_DENY) {
|
||||
/* If yes, set reported metric to Max */
|
||||
ne->reported_metric.delay =
|
||||
@ -626,13 +622,13 @@ void eigrp_update_send_EOT(struct eigrp_neighbor *nbr)
|
||||
/* Check if any list fits */
|
||||
if ((alist
|
||||
&& access_list_apply (alist,
|
||||
(struct prefix *) dest_addr) == FILTER_DENY)||
|
||||
dest_addr) == FILTER_DENY)||
|
||||
(plist && prefix_list_apply (plist,
|
||||
(struct prefix *) dest_addr) == PREFIX_DENY)||
|
||||
dest_addr) == PREFIX_DENY)||
|
||||
(alist_i && access_list_apply (alist_i,
|
||||
(struct prefix *) dest_addr) == FILTER_DENY)||
|
||||
dest_addr) == FILTER_DENY)||
|
||||
(plist_i && prefix_list_apply (plist_i,
|
||||
(struct prefix *) dest_addr) == PREFIX_DENY)) {
|
||||
dest_addr) == PREFIX_DENY)) {
|
||||
//pe->reported_metric.delay = EIGRP_MAX_METRIC;
|
||||
continue;
|
||||
} else {
|
||||
@ -730,19 +726,19 @@ void eigrp_update_send(struct eigrp_interface *ei)
|
||||
/* Check if any list fits */
|
||||
if ((alist
|
||||
&& access_list_apply(alist,
|
||||
(struct prefix *)dest_addr)
|
||||
dest_addr)
|
||||
== FILTER_DENY)
|
||||
|| (plist
|
||||
&& prefix_list_apply(plist,
|
||||
(struct prefix *)dest_addr)
|
||||
dest_addr)
|
||||
== PREFIX_DENY)
|
||||
|| (alist_i
|
||||
&& access_list_apply(alist_i,
|
||||
(struct prefix *)dest_addr)
|
||||
dest_addr)
|
||||
== FILTER_DENY)
|
||||
|| (plist_i
|
||||
&& prefix_list_apply(plist_i,
|
||||
(struct prefix *)dest_addr)
|
||||
dest_addr)
|
||||
== PREFIX_DENY)) {
|
||||
// pe->reported_metric.delay = EIGRP_MAX_METRIC;
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user