Skip to content

Commit 69e6895

Browse files
committed
gk: improve log entries of check_gateway_prefix()
1 parent 01b4623 commit 69e6895

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

gk/fib.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,12 +1389,14 @@ add_fib_entry_locked(struct ip_prefix *prefix,
13891389
/*
13901390
* Return 0 when @gw_addr is not included in @prefix.
13911391
* If not, or if there is an error, return -1.
1392+
*
1393+
* Issue #267 discusses the assumptions behind this verification.
13921394
*/
13931395
static int
13941396
check_gateway_prefix(struct ip_prefix *prefix, struct ipaddr *gw_addr)
13951397
{
13961398
if (unlikely(prefix->addr.proto != gw_addr->proto)) {
1397-
GK_LOG(ERR, "IP prefix protocol (%hu) does not match the gateway address protocol (%hu) for prefix string %s\n",
1399+
GK_LOG(ERR, "IP prefix protocol (%hu) does not match the gateway address protocol (%hu) for prefix %s\n",
13981400
prefix->addr.proto, gw_addr->proto, prefix->str);
13991401
return -1;
14001402
}
@@ -1425,10 +1427,13 @@ check_gateway_prefix(struct ip_prefix *prefix, struct ipaddr *gw_addr)
14251427
return 0;
14261428
}
14271429
} else {
1428-
GK_LOG(ERR, "Unexpected condition at %s: unknown IP type %hu for prefix string %s\n",
1430+
GK_LOG(ERR, "Unexpected condition at %s(): unknown IP type %hu for prefix %s\n",
14291431
__func__, gw_addr->proto, prefix->str);
1432+
return -1;
14301433
}
14311434

1435+
GK_LOG(ERR, "Gateway address is in prefix %s, so gateway is not a neighbor\n",
1436+
prefix->str);
14321437
return -1;
14331438
}
14341439

@@ -1668,10 +1673,8 @@ add_fib_entry_numerical(struct ip_prefix *prefix_info,
16681673
* are not included in the prefix.
16691674
*/
16701675
ret = check_gateway_prefix(prefix_info, &gw_addrs[i]);
1671-
if (ret < 0) {
1672-
GK_LOG(ERR, "Gateway address is not in prefix, or error occurred\n");
1676+
if (ret < 0)
16731677
return -1;
1674-
}
16751678
}
16761679

16771680
rte_spinlock_lock_tm(&gk_conf->lpm_tbl.lock);

0 commit comments

Comments
 (0)