*: consolidate sockopt_ apis in sockopt.c module - #21746
Conversation
Greptile SummaryThis PR relocates five socket-option helpers ( Confidence Score: 5/5Safe to merge β purely a code-move refactor with no functional changes; both findings are minor style issues. All remaining comments are P2 (a misleading #endif comment and an inconsistent include path). No logic was altered; transitive include analysis confirms no broken symbols at any call site. lib/sockopt.c (misleading #endif /* 0 */ comment) and ospfd/ospf_apiserver.c (lib/ prefix inconsistency). Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["sockopt_reuseaddr\nsockopt_reuseport\nsockopt_ttl\nsockopt_minttl\nsockopt_v6only"]
subgraph Before
S1["lib/sockunion.c\n(implementation)"]
S2["lib/sockunion.h\n(declaration)"]
end
subgraph After
T1["lib/sockopt.c\n(implementation)"]
T2["lib/sockopt.h\n(declaration)"]
end
A -->|was in| Before
A -->|moved to| After
T2 -->|includes| SU["lib/sockunion.h\n(still available transitively)"]
CALLERS["bfdd/dplane.c\nbgpd/bgp_bmp.c\nospfd/ospf_apiserver.c"] -->|now include| T2
Prompt To Fix All With AIThis is a comment left during a code review.
Path: ospfd/ospf_apiserver.c
Line: 24
Comment:
**Inconsistent include path style**
All other lib headers in this file are included without the `lib/` prefix (e.g. `"linklist.h"`, `"prefix.h"`, `"frrevent.h"`), but the newly-added include uses the full `"lib/sockopt.h"` form. This is inconsistent with the existing style in this file and should be `"sockopt.h"` to match.
```suggestion
#include "sockopt.h"
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: lib/sockopt.c
Line: 803
Comment:
**Misleading `#endif` comment**
The closing `#endif` comment says `/* 0 */`, which has no relation to the guarding `#ifdef SO_REUSEPORT` above it. This was copied as-is from `sockunion.c`, but now that this is the canonical location the comment should be corrected to reflect the actual macro name.
```suggestion
#endif /* SO_REUSEPORT */
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "*: consolidate sockopt_ apis in sockopt...." | Re-trigger Greptile |
| #include "hash.h" | ||
| #include "sockunion.h" /* for inet_aton() */ | ||
| #include "buffer.h" | ||
| #include "lib/sockopt.h" |
There was a problem hiding this comment.
Inconsistent include path style
All other lib headers in this file are included without the lib/ prefix (e.g. "linklist.h", "prefix.h", "frrevent.h"), but the newly-added include uses the full "lib/sockopt.h" form. This is inconsistent with the existing style in this file and should be "sockopt.h" to match.
| #include "lib/sockopt.h" | |
| #include "sockopt.h" |
Prompt To Fix With AI
This is a comment left during a code review.
Path: ospfd/ospf_apiserver.c
Line: 24
Comment:
**Inconsistent include path style**
All other lib headers in this file are included without the `lib/` prefix (e.g. `"linklist.h"`, `"prefix.h"`, `"frrevent.h"`), but the newly-added include uses the full `"lib/sockopt.h"` form. This is inconsistent with the existing style in this file and should be `"sockopt.h"` to match.
```suggestion
#include "sockopt.h"
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
|
||
| int sockopt_ttl(int family, int sock, int ttl) | ||
| { | ||
| int ret; |
There was a problem hiding this comment.
The closing #endif comment says /* 0 */, which has no relation to the guarding #ifdef SO_REUSEPORT above it. This was copied as-is from sockunion.c, but now that this is the canonical location the comment should be corrected to reflect the actual macro name.
| int ret; | |
| #endif /* SO_REUSEPORT */ |
Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/sockopt.c
Line: 803
Comment:
**Misleading `#endif` comment**
The closing `#endif` comment says `/* 0 */`, which has no relation to the guarding `#ifdef SO_REUSEPORT` above it. This was copied as-is from `sockunion.c`, but now that this is the canonical location the comment should be corrected to reflect the actual macro name.
```suggestion
#endif /* SO_REUSEPORT */
```
How can I resolve this? If you propose a fix, please make it concise.Several sockopt_xxx apis were in sockunion - move them into the sockopt module and header. Signed-off-by: Mark Stapp <mjs@cisco.com>
124aae4 to
4abc1b7
Compare
|
pushed a fix for the checkpatch report |
|
@mjstapp please fix frrbot complaint and this is ready to go |
all of those are the "100 columns" things that are still optional? |
Several sockopt_xxx apis were in the sockunion module - move them into the sockopt module and header.