Page MenuHomeFreeBSD

Move route-specific ddb commands to route/route_ddb.c
ClosedPublic

Authored by melifaro on Apr 24 2020, 8:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 1, 9:23 PM
Unknown Object (File)
Wed, May 1, 12:12 PM
Unknown Object (File)
Wed, May 1, 12:04 PM
Unknown Object (File)
Mar 31 2024, 2:51 PM
Unknown Object (File)
Feb 22 2024, 4:31 AM
Unknown Object (File)
Feb 12 2024, 4:32 PM
Unknown Object (File)
Dec 28 2023, 2:58 PM
Unknown Object (File)
Dec 23 2023, 1:56 PM
Subscribers

Details

Summary

Currently functionality resides in rtsock.c, which is a controlling interface, external to the routing system.
Additionally, DDB-supporting functionality is > 100SLOC, which deserves a separate file.

Given that, move this functionality to a newly-created net/route/route_ddb.c.

While here, switch rtentry field accesses to nhop field accesses where necessary.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

melifaro added reviewers: cem, network.

Could you have separate phabricator reviews for the move and the rt -> nh changes? As-is, it is impossible to see what was modified in the moved contents. No objection to the general idea.

sys/net/route/route_ddb.c
4 ↗(On Diff #70958)

If I authored all or most of it (I'm not sure), I would use "Copyright 2019 Conrad Meyer <cem@FreeBSD.org>" here.

In D24561#540790, @cem wrote:

Could you have separate phabricator reviews for the move and the rt -> nh changes? As-is, it is impossible to see what was modified in the moved contents. No objection to the general idea.

Sure, will update the review shortly.

sys/net/route/route_ddb.c
4 ↗(On Diff #70958)

Well, rS352112 was committed by you :-) I'll update the copyright.

Btw, do you by chance recall why reading the whole IPv4/IPv6 address as a string first and then using inet_pton() to do the conversion is a bad idea?

melifaro edited the summary of this revision. (Show Details)

Update to reflect the comments.

Sure, will update the review shortly.

Thanks!

sys/net/route/route_ddb.c
4 ↗(On Diff #70958)

Yeah, looking at 352112 and the differential I don't see any other Submitted by so I must have written it. Time flies :-).

ddb's parser is greedy and can't tolerate ambiguity. Anything starting with a decimal digit is a "number," not a "string" in ddb. Additionally, inet_pton as an API suffers from requiring the caller to know the correct af in advance, so we have to parse the string at least a little bit to invoke inet_pton correctly.

sys/net/route/route_ddb.c
4 ↗(On Diff #70958)

ddb's parser is greedy and can't tolerate ambiguity. Anything starting with a decimal digit is a "number," not a "string" in ddb.

Ohh, got it.
Re inet_pton(): typically people guess family by doing strchr(addr, ':').

Anyway, that was just my curiosity.

@cem: is there anything else I need to address in this change?

It’s probably fine, but I can’t tell what was modified in the move.

In D24561#541556, @cem wrote:

It’s probably fine, but I can’t tell what was modified in the move.

Nothing, it is a simple copypaste. I'll submit another review with the actual changes once I get this landed.

Ok, thanks!

sys/net/route/route_ddb.c
53 ↗(On Diff #71015)

For example, I don't see nhop_utils include in the source file.

This revision is now accepted and ready to land.Apr 28 2020, 3:19 PM
sys/net/route/route_ddb.c
53 ↗(On Diff #71015)

Yep, forgot to remove this one, thanks for checking! This part was indeed modified, as rtsock.c has more dependencies. I'll commit the change w/o this header.