Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ip origin tracking #135

Merged
merged 11 commits into from
Sep 19, 2023
Merged

Conversation

rical
Copy link
Contributor

@rical rical commented Sep 13, 2023

This PR adds ip proto / origin info.

root@infix-00-00-00:/> show interfaces 
INTERFACE        PROTOCOL          STATE          DATA                          
e0               ethernet          UP             02:00:00:00:00:00             
                 ipv4                             192.168.1.1/24 (static)
                 ipv4                             198.10.1.162/24 (dhcp)
lo               ethernet          UP             00:00:00:00:00:00             
                 ipv4                             127.0.0.1/8 (static)

It does this by setting ip/kernel proto and converting it to YANG origin, which is exposed to the user.

NOTE

  • The udhcpc default.script is modified in this PR, I have tested it manually and it works better than before (see commit msg). However, such modifications are error-prone and we need to beef up testing in this area.

Add a pristine upstream patch which includes protocol info in ip the
ip command.

More info:
https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=bdb8d85
This file is read by iproute2 and creates valid names for ip proto.

Such as "static" in:
ip addr add dev e0 192.168.1.1/24 proto static

Signed-off-by: Richard Alpe <[email protected]>
This commit is purely cosmetic.

Signed-off-by: Richard Alpe <[email protected]>
Add protocol from ip route (kernel) as origin in YANG model.

Note, we control the names static and dhcp in the file rt_addrprotos.

Signed-off-by: Richard Alpe <[email protected]>
Cosmetic code cleanup.

Signed-off-by: Richard Alpe <[email protected]>
Print the origin which is based on info from ip route proto.

Signed-off-by: Richard Alpe <[email protected]>
Add a pristine version of default.script to our local board override.
The reason for this commit is to track changes we do to it.

Signed-off-by: Richard Alpe <[email protected]>
This fixes one bug in Infix, namely that dhcp removes all other
statically configured addresses. However it introduces a new one
where dhcp renewals with new ip addresses are added as "duplicates",
we fix this in a later commit in this patchset.

Signed-off-by: Richard Alpe <[email protected]>
Flush addresses during shutdown and renewal with new address.
This is kind of a hack and needs further testing.

Signed-off-by: Richard Alpe <[email protected]>
There might be more places in confd where this is needed. This works
for the most basic use case.

The proto set here is picked up by statd and converted into a YANG
origin, which is exposed to the user.

Signed-off-by: Richard Alpe <[email protected]>
@rical rical force-pushed the add-ip-origin-tracking branch from facab1c to 10167b5 Compare September 18, 2023 09:02
@rical rical marked this pull request as ready for review September 18, 2023 09:05
@troglobit troglobit merged commit 12d4760 into kernelkit:main Sep 19, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants