-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Rewrite arch/bpf #4497
Rewrite arch/bpf #4497
Conversation
35d67e5
to
6929e7d
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4497 +/- ##
==========================================
- Coverage 81.68% 81.58% -0.11%
==========================================
Files 355 356 +1
Lines 84936 85207 +271
==========================================
+ Hits 69384 69519 +135
- Misses 15552 15688 +136
|
@dhgutteridge Hi & sorry for bothering. I was wondering if you'd have some advices regarding making this PR work on NetBSD. Unlike OpenBSD and FreeBSD, NetBSD has chosen to versionize the Also if you have something to say regarding this PR in general, feel free to give your opinion :) Thanks for the help, cheers |
Sure, my pleasure. Thanks for supporting us. :)
I think you'd want the magic number 6 here, in other words, the current value of NET_RT_IFLIST. The other values are versioned for compatibility with old NetBSD binaries from EOL releases. Since you're tracking NetBSD 10, I believe, you'd want the most current value. (Now, whether that gives you any additional output needed for your purposes is another matter, I suppose. "3" may "just work" for you. Here I don't know how OpenBSD and FreeBSD vary in their content.)
I could test it for you on NetBSD and/or gather input for any other questions you have.
|
Thanks a lot ! I tried using that in the latest commit. It should now almost support NetBSD.
Thanks ! I've taken inspiration from If you want to try this PR out BTW, you should be looking at the contents of |
Apparently the first 6 octets of the sockaddr data are garbage (always 0xFFFFFFFFFF), followed by the actual IPv6 netmask. As far as my understanding goes at least. The netmask payload generally looks kinda malformed, unless I missed something, as the sockaddr type is also FF. On other BSDs, it was either AF_INET6 or 0. |
429dbf1
to
848b4ef
Compare
f868cd2
to
c495b59
Compare
c495b59
to
95abcb0
Compare
@p-l- @guedou @polybassa It however works in its latest commit on all *BSDs mentionned above. |
/packit build |
Looks good to me. |
Then let's merge that monster and go for 2.6.0. |
This rewrites most of the arch/bpf code that handles the loading of
conf.ifaces
,conf.route
andconf.route6
, in order to usePF_ROUTE
(instead of the current reading involving subprocess, parsing ifconfig, and other kinda crappy stuff).This should:
Also:
conf.iface
no longer takes a bigger role on IPv6 routing. Considering the Scoped IPs PR, it wasn't necessary anymore.get_if_raw_hwaddr
where not necessary. This is only really needed on Linux, not other plateforms.conf.iface
is used inconf.route6.route()
. Now that we support scoped IPs, this isn't needed and adds confusion.NetworkInterface
to remember the interface type (first parameter that get_if_raw_hwaddr returned). This IS cross plateform (that being said, if Windows uses standard IANA types, most other plateforms, linux included, use custom garbage (e.g. ARPHRD... constants))(yeah this is a followup to #4352)
TESTED ON:
Annoyingly it seems every BSD (at least FreeBSD, OpenBSD and NetBSD) have different rt_* structures. Ugh.