Commit Graph

12 Commits

Author SHA1 Message Date
Olivier Dugeon
8db278b5e3 ospfd: Correct Coverity defects
When browsing or parsing OSPF LSA TLVs, we need to use the LSA length which is
part of the LSA header. This length, encoded in 16 bits, must be first
converted to host byte order with ntohs() function. However, Coverity Scan
considers that ntohs() function return TAINTED data. Thus, when the length is
used to control for() loop, Coverity Scan marks this part of the code as defect
with "Untrusted Loop Bound" due to the usage of Tainted variable. Similar
problems occur when browsing sub-TLV where length is extracted with ntohs().

To overcome this limitation, a size attribute has been added to the ospf_lsa
structure. The size is set when lsa->data buffer is allocated. In addition,
when an OSPF packet is received, the size of the payload is controlled before
contains is processed. For OSPF LSA, this allow a secure buffer allocation.
Thus, new size attribute contains the exact buffer allocation allowing a
strict control during TLV browsing.

This patch adds extra control to bound for() loop during TLV browsing to
avoid potential problem as suggested by Coverity Scan. Controls are based
on new size attribute of the ospf_lsa structure to avoid any ambiguity.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2021-05-19 09:48:54 +02:00
Donald Sharp
a4544597f4 ospfd: Use _func__ instead of __PRETTY_FUNCTION__
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-12 12:03:59 -04:00
Mark Stapp
72327cf3e7 * : clean up format specifiers for gcc-10
gcc 10 complains about some of our format specs, fix them. Use
atomic size_t in thread stats, to work around platform
differences.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-11-04 16:56:17 -05:00
Mark Stapp
96b663a381 ospfd: replace inet_ntoa
Stop using inet_ntoa, use %pI4 etc or inet_ntop instead

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22 13:37:25 -04:00
Donald Sharp
2c6592c140
Merge pull request #7309 from mjstapp/fix_ospf_gr_reasons
ospfd: make GR reason string production safer
2020-10-14 19:19:39 -04:00
Mark Stapp
d81937481d ospfd: fix SA warnings in ospfd, ospfclient
Fix some SA warnings in ospf GR and ospfclient code.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-14 13:41:00 -04:00
Mark Stapp
d05d5280e6 ospfd: make reason string production safer
Use to-string functions for GR message codes instead of raw
string array indexing; the values used can come in packets
and are not validated.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-14 12:51:52 -04:00
rgirada
abd5b8c72c ospfd: GR helper specific show commands
Description:
	The following  show commands are added to display helper specific
	information.
	1.show ip ospf graceful-restart helper [detail] [json]
		--> displays user configurations and list of all helpers details.

	2.show ip ospf neighbour detail
		--> diplays helper details

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 00:02:37 -07:00
rgirada
07b33add1d ospfd: GR helper config commands
Description:
	The following commands are added for helper support.
	1.[no] graceful-restart helper-only
	2.[no] graceful-restart helper-only <A.B.C.D>
	3.[no] graceful-restart helper lsa-check-disable
	4.[no] graceful-restart helper supported-grace-time
	5.[no] graceful-restart helper planned-only

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 00:02:37 -07:00
rgirada
df074ec33a ospfd: GR helper exit scenarios
Description:
	The follwoing helper exit scenarios are handled.
	1. Recv Max age grace LSA from RESTARTER.
	2. Grace timer expiry.
	3. Due to topo change if lsa check is enabled.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 00:02:37 -07:00
rgirada
ad68699217 ospfd: Grace LSA processing
Description:
	1. Grace LSA processing.
	2. Validations to become a Helper. rfc3623 section 3.1

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 00:02:37 -07:00
rgirada
06bc3110d3 ospfd: ospf GR helper initialization
Description:
	1. Graceful restart helper init/de-init.
	2. Defining dedicated memory for helper.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 00:02:33 -07:00