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 netlink implementation #2009

Merged
merged 8 commits into from
Jul 23, 2024
Merged

Add netlink implementation #2009

merged 8 commits into from
Jul 23, 2024

Conversation

DL6ER
Copy link
Member

@DL6ER DL6ER commented Jul 14, 2024

What does this implement/fix?

The existing implementation for /api/network/{gateway,interface} relied on manually parsing various files in /proc/ and /sys/class/net. This had several drawbacks, e.g., was it not possible to get IPv6 routes (and, hence, gateways) or lifetimes and priority of IPv6 addresses.

This PR instead implements Netlink which is the proper way of querying the kernel in a standardized way about routes and interface details. It is also the same method used by the popular ip command (e.g. ip a and ip r):

Netlink is designed and used for transferring miscellaneous networking information between the kernel space and userspace processes. Networking utilities, such as the iproute2 family and the utilities used for configuring mac80211-based wireless drivers, use Netlink to communicate with the Linux kernel from userspace. Netlink provides a standard socket-based interface for userspace processes, and a kernel-side API for internal use by kernel modules. Originally, Netlink used the AF_NETLINK socket family.

Netlink is designed to be a more flexible successor to ioctl; RFC 3549 describes the protocol in detail.

This change allows us to provide much better/more complete interface information through the API offering the base for implementing this Discourse feature request.

Note: The prefered (one r) typo is a standard typo in Linux and expected.


Related issue or feature (if applicable): N/A

Pull request in docs with documentation (if applicable): N/A


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)

Checklist:

  • The code change is tested and works locally.
  • I based my code and PRs against the repositories developmental branch.
  • I signed off all commits. Pi-hole enforces the DCO for all contributions
  • I signed all my commits. Pi-hole requires signatures to verify authorship
  • I have read the above and my PR is ready for review.

DL6ER added 5 commits July 8, 2024 22:48
…or using 64 bit interface statistics if available. The reason is that the legacy statistics use 32 bit conters which overflow every 4 GB of interface traffic

Signed-off-by: DL6ER <[email protected]>
…DONNED and cannot be used any longer for BOGUS testing

Signed-off-by: DL6ER <[email protected]>
Copy link
Member

@yubiuser yubiuser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you modify the devcontainer plugins?

@DL6ER DL6ER mentioned this pull request Jul 14, 2024
5 tasks
@DL6ER
Copy link
Member Author

DL6ER commented Jul 15, 2024

Because these two plugins are what I manually need to reinstall after rebuilding the container once a week when a new version is pushed to GHCR. It is a step that seems worth automating.

@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/i-updates-are-available/71248/3

yubiuser
yubiuser previously approved these changes Jul 18, 2024
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

1 similar comment
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Copy link

Conflicts have been resolved.

@DL6ER
Copy link
Member Author

DL6ER commented Jul 22, 2024

Holding merge until #2014 is merged as future development-v6 builds would fail due to the external DNSSEC issue.

Also, we are waiting until pi-hole/PADD#395 is ready as well.

@DL6ER DL6ER merged commit 1381fd0 into development-v6 Jul 23, 2024
17 checks passed
@DL6ER DL6ER deleted the tweak/api_network_info branch July 23, 2024 16:05
@DL6ER DL6ER mentioned this pull request Sep 18, 2024
5 tasks
@PromoFaux PromoFaux mentioned this pull request Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants