/* Get BGP distance node. */
rn = bgp_node_get(bgp_distance_table[afi][safi], (struct prefix *)&p);
- if (rn->info) {
- bdistance = rn->info;
+ bdistance = bgp_distance_get_node(rn);
+ if (bdistance)
bgp_unlock_node(rn);
- } else {
+ else {
bdistance = bgp_distance_new();
- rn->info = bdistance;
+ bgp_distance_set_node(rn, bdistance);
}
/* Set distance value. */
return CMD_WARNING_CONFIG_FAILED;
}
- bdistance = rn->info;
+ bdistance = bgp_distance_get_node(rn);
distance = atoi(distance_str);
if (bdistance->distance != distance) {
sockunion2hostprefix(&peer->su, &q);
rn = bgp_node_match(bgp_distance_table[afi][safi], &q);
if (rn) {
- bdistance = rn->info;
+ bdistance = bgp_distance_get_node(rn);
bgp_unlock_node(rn);
if (bdistance->access_list) {
}
for (rn = bgp_table_top(bgp_distance_table[afi][safi]); rn;
- rn = bgp_route_next(rn))
- if ((bdistance = rn->info) != NULL) {
+ rn = bgp_route_next(rn)) {
+ bdistance = bgp_distance_get_node(rn);
+ if (bdistance != NULL) {
char buf[PREFIX_STRLEN];
vty_out(vty, " distance %d %s %s\n",
bdistance->access_list ? bdistance->access_list
: "");
}
+ }
}
/* Allocate routing table structure and install commands. */
node->info = aggregate;
}
+static inline struct bgp_distance *bgp_distance_get_node(struct bgp_node *node)
+{
+ return node->info;
+}
+
+static inline void bgp_distance_set_node(struct bgp_node *node,
+ struct bgp_distance *distance)
+{
+ node->info = distance;
+}
+
#endif /* _QUAGGA_BGP_TABLE_H */