summaryrefslogtreecommitdiff
path: root/bgpd/bgp_main.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2020-04-04 23:26:19 -0400
committerQuentin Young <qlyoung@cumulusnetworks.com>2020-04-04 23:26:19 -0400
commit1e03d6bc760861ea954f8485604eba67fd05f7c0 (patch)
tree3842a7999582e37b62b00dd7fcefa0898879a1ad /bgpd/bgp_main.c
parentcd05906c41aaaf94e06fa9d14a7634bdffd99ed0 (diff)
bgpd, zebra: don't compare unsigned < 0
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_main.c')
-rw-r--r--bgpd/bgp_main.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index c14a1a05ac..8f0ccca742 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -425,17 +425,21 @@ int main(int argc, char **argv)
else
bgp_port = tmp_port;
break;
- case 'e':
- multipath_num = atoi(optarg);
- if (multipath_num > MULTIPATH_NUM
- || multipath_num <= 0) {
+ case 'e': {
+ unsigned long int parsed_multipath =
+ strtoul(optarg, NULL, 10);
+ if (parsed_multipath == 0
+ || parsed_multipath > MULTIPATH_NUM
+ || parsed_multipath > UINT_MAX) {
flog_err(
EC_BGP_MULTIPATH,
- "Multipath Number specified must be less than %d and greater than 0",
+ "Multipath Number specified must be less than %u and greater than 0",
MULTIPATH_NUM);
return 1;
}
+ multipath_num = parsed_multipath;
break;
+ }
case 'l':
bgp_address = optarg;
/* listenon implies -n */