summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_te.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-03-30 21:48:53 +0200
committerDonald Sharp <sharpd@nvidia.com>2023-04-07 00:00:09 +0200
commitb589466918337c11021fd4085aacf0d7e963a9a4 (patch)
tree9a56c43152d2733b5a1674152ac8d2c70e6dc891 /ospfd/ospf_te.c
parentMerge pull request #13214 from chiragshah6/fdev2 (diff)
downloadfrr-b589466918337c11021fd4085aacf0d7e963a9a4.tar.xz
frr-b589466918337c11021fd4085aacf0d7e963a9a4.zip
*: Use a `struct prefix *p` instead of a `struct prefix` in functions
When passing a prefix into a function let's pass by address instead of pass by value. Let's save our stack space. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'ospfd/ospf_te.c')
-rw-r--r--ospfd/ospf_te.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index dc9dd3430..b14002714 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -1781,7 +1781,7 @@ static void ospf_te_update_link(struct ls_ted *ted, struct ls_vertex *vertex,
* @param metric Standard metric attached to this Edge
*/
static void ospf_te_update_subnet(struct ls_ted *ted, struct ls_vertex *vertex,
- struct prefix p, uint8_t metric)
+ struct prefix *p, uint8_t metric)
{
struct ls_subnet *subnet;
struct ls_prefix *ls_pref;
@@ -1840,7 +1840,7 @@ static void ospf_te_delete_subnet(struct ls_ted *ted, struct in_addr addr)
p.family = AF_INET;
p.prefixlen = IPV4_MAX_BITLEN;
p.u.prefix4 = addr;
- subnet = ls_find_subnet(ted, p);
+ subnet = ls_find_subnet(ted, &p);
/* Remove subnet if found */
if (subnet) {
@@ -1933,7 +1933,7 @@ static int ospf_te_parse_router_lsa(struct ls_ted *ted, struct ospf_lsa *lsa)
p.prefixlen = IPV4_MAX_BITLEN;
p.u.prefix4 = rl->link[i].link_data;
metric = ntohs(rl->link[i].metric);
- ospf_te_update_subnet(ted, vertex, p, metric);
+ ospf_te_update_subnet(ted, vertex, &p, metric);
break;
case LSA_LINK_TYPE_STUB:
/* Keep only /32 prefix */
@@ -1942,7 +1942,7 @@ static int ospf_te_parse_router_lsa(struct ls_ted *ted, struct ospf_lsa *lsa)
p.family = AF_INET;
p.u.prefix4 = rl->link[i].link_id;
metric = ntohs(rl->link[i].metric);
- ospf_te_update_subnet(ted, vertex, p, metric);
+ ospf_te_update_subnet(ted, vertex, &p, metric);
}
break;
default:
@@ -2074,12 +2074,12 @@ static void ospf_te_update_remote_asbr(struct ls_ted *ted, struct ls_edge *edge)
p.family = AF_INET;
p.prefixlen = IPV4_MAX_BITLEN;
p.u.prefix4 = attr->standard.local;
- ospf_te_update_subnet(ted, edge->source, p, attr->standard.te_metric);
+ ospf_te_update_subnet(ted, edge->source, &p, attr->standard.te_metric);
p.family = AF_INET;
p.prefixlen = IPV4_MAX_BITLEN;
p.u.prefix4 = attr->standard.remote_addr;
- ospf_te_update_subnet(ted, vertex, p, attr->standard.te_metric);
+ ospf_te_update_subnet(ted, vertex, &p, attr->standard.te_metric);
/* Connect Edge to the remote Vertex */
if (edge->destination == NULL) {
@@ -2625,14 +2625,14 @@ static int ospf_te_parse_ext_pref(struct ls_ted *ted, struct ospf_lsa *lsa)
pref.family = AF_INET;
pref.prefixlen = ext->pref_length;
pref.u.prefix4 = ext->address;
- subnet = ls_find_subnet(ted, pref);
+ subnet = ls_find_subnet(ted, &pref);
/* Create new Link State Prefix if not found */
if (!subnet) {
lnid.origin = OSPFv2;
lnid.id.ip.addr = lsa->data->adv_router;
lnid.id.ip.area_id = lsa->area->area_id;
- ls_pref = ls_prefix_new(lnid, pref);
+ ls_pref = ls_prefix_new(lnid, &pref);
/* and add it to the TED */
subnet = ls_subnet_add(ted, ls_pref);
}
@@ -2698,7 +2698,7 @@ static int ospf_te_delete_ext_pref(struct ls_ted *ted, struct ospf_lsa *lsa)
pref.family = AF_INET;
pref.prefixlen = ext->pref_length;
pref.u.prefix4 = ext->address;
- subnet = ls_find_subnet(ted, pref);
+ subnet = ls_find_subnet(ted, &pref);
/* Check if there is a corresponding subnet */
if (!subnet)
@@ -4398,7 +4398,7 @@ DEFUN (show_ip_ospf_mpls_te_db,
return CMD_WARNING_CONFIG_FAILED;
}
/* Get the Subnet from the Link State Database */
- subnet = ls_find_subnet(OspfMplsTE.ted, pref);
+ subnet = ls_find_subnet(OspfMplsTE.ted, &pref);
if (!subnet) {
vty_out(vty, "No subnet found for ID %pFX\n",
&pref);