Page MenuHomeFreeBSD
Feed Advanced Search

Jan 13 2023

melifaro committed rGe6466ec48d29: routing: remove info argument from add/change_route_nhop(). (authored by melifaro).
routing: remove info argument from add/change_route_nhop().
Jan 13 2023, 9:26 PM
melifaro committed rG81a72d997e22: tcp: virtualise net.inet.tcp.msl sysctl. (authored by melifaro).
tcp: virtualise net.inet.tcp.msl sysctl.
Jan 13 2023, 9:26 PM
melifaro committed rG3cb0bc54ec48: net/route: Use __diagused for variables only used in KASSERT(). (authored by jhb).
net/route: Use __diagused for variables only used in KASSERT().
Jan 13 2023, 9:26 PM
melifaro committed rG86f499e00177: unlink_nhgrp: Remove write-only variable. (authored by jhb).
unlink_nhgrp: Remove write-only variable.
Jan 13 2023, 9:26 PM
melifaro committed rG1c915de99108: change_mpath_route: Remove write-only nh variable. (authored by jhb).
change_mpath_route: Remove write-only nh variable.
Jan 13 2023, 9:26 PM
melifaro committed rGc9b6853febc5: routing: move route expiration time to its nexthop (authored by melifaro).
routing: move route expiration time to its nexthop
Jan 13 2023, 9:26 PM
melifaro committed rG1d5633bdb56f: routing: add debug printing helpers for rtentry and RTM* cmds. (authored by melifaro).
routing: add debug printing helpers for rtentry and RTM* cmds.
Jan 13 2023, 9:25 PM
melifaro committed rGe8508a64b7d2: routing: actually sort nexthops in nhgs by their index (authored by melifaro).
routing: actually sort nexthops in nhgs by their index
Jan 13 2023, 9:25 PM
melifaro committed rG884b1fa66bc1: routing: simplify decompose_change_notification(). (authored by melifaro).
routing: simplify decompose_change_notification().
Jan 13 2023, 9:25 PM
melifaro committed rG6d7d5b869a4f: routing: improve debugging. (authored by melifaro).
routing: improve debugging.
Jan 13 2023, 9:25 PM
melifaro committed rGf7db1d569890: routing: fix debug headers added in 6fa8ed43ee0c. (authored by melifaro).
routing: fix debug headers added in 6fa8ed43ee0c.
Jan 13 2023, 9:25 PM
melifaro committed rGede90c997743: routing: fix RTM_CHANGE nhgroup updates. (authored by melifaro).
routing: fix RTM_CHANGE nhgroup updates.
Jan 13 2023, 9:25 PM
melifaro committed rGcda085d1ccef: routing: improve debug logging (authored by melifaro).
routing: improve debug logging
Jan 13 2023, 9:25 PM
melifaro committed rG9cc645e3e382: netstat: print path weight when showing routes in structured output. (authored by melifaro).
netstat: print path weight when showing routes in structured output.
Jan 13 2023, 9:25 PM
melifaro committed rGf51d7f8fb5b0: routing: copy nexthop fib when changing existing nexthop (authored by melifaro).
routing: copy nexthop fib when changing existing nexthop
Jan 13 2023, 9:25 PM
melifaro abandoned D28812: Add arp/ndp tests in addition to rtsock ll tests..

Landed in a different fashion.

Jan 13 2023, 8:50 PM
melifaro committed rGbdd60b224fa4: ipfw: Add missing 'va' code point name (authored by jlduran_gmail.com).
ipfw: Add missing 'va' code point name
Jan 13 2023, 8:23 PM
melifaro closed D37508: ipfw: Add missing 'va' code point name.
Jan 13 2023, 8:23 PM
melifaro committed rG692e19cf5195: netlink: add netlink to GENERIC@amd64 (authored by melifaro).
netlink: add netlink to GENERIC@amd64
Jan 13 2023, 10:42 AM
melifaro closed D37783: netlink: add netlink to GENERIC.
Jan 13 2023, 10:42 AM

Jan 12 2023

melifaro accepted D38030: ifnet/API: Move the IfAPI from if_var.h to if.h.
Jan 12 2023, 1:24 PM

Jan 11 2023

melifaro accepted D37785: Convert xl(4) to drvapi.

LGTM.
Good old days.

Jan 11 2023, 3:50 PM
melifaro closed D38021: pytest: Add an IPv4 loopback address.
Jan 11 2023, 2:59 PM
melifaro committed rG4856aeaaed17: tests: Add an IPv4 loopback address of 127.0.0.1/8 to the lo0 (authored by jlduran_gmail.com).
tests: Add an IPv4 loopback address of 127.0.0.1/8 to the lo0
Jan 11 2023, 2:59 PM
melifaro added a comment to D37971: testing: change python ATF cleanup handlers to be more pythonic.
In D37971#863583, @ngie wrote:

I hate to be a wet blanket, but a lot of the code seems to go against design decisions made in pytest around fixtures, extendability, etc.

First of all, thank you for the feedback.
Some of the things intentionally or unintentionally are done in ATF way, which does not match pytest. If you could share a bit more detailed feedback, I'd try to make the framework changes to take it closer to the pytest.

In particular, just glancing at this commit, it seems to rely on J-Unit-like structure (used in unittest), which is not strictly adhered to in pytest.

Currently, the primary use case of python integration is development of the tests with the relatively complex setup/teardown procedures (e.g. custom vnet-based topologies). That is the part I feel is the least covered by the shell or c-based tests. Any suggestions on doing it in a more pytest way?

FWIW, I honestly think integration should be the other way around: ATF should integrate into pytest, not pytest should integrate into ATF. If things were done in that manner and we used the JUnit output format (supported natively in pytest), we could move away from Kyua to a framework that is less bespoke, has a ton less boilerplate than ATF, has better developer and user experience, and has better opensource mindshare than ATF/Kyua.
The main value ATF/Kyua provides (IMHO) is the ability to integrate in tests from NetBSD and a format to express legacy tests in, which gave FreeBSD a great head start in terms of CI/testability. Other than that, it's kind of a kludgy framework.

I agree with the ATF/Kyua assessment - I don't like the API or (lack of) functionality either. I agree that pytest can be a good candidate for the core testing framework, provided there is a consensus on that and the migration/support engineering resources are secured. I don't think we're here yet. Currently, shell and C test files correspond to around 90% of the all test files, with similar figures across kernel and userland. Out of the remaining python files, only 10% represent pytest tests; the rest are wrapped with the shell scripts.
Personally, I think that the most beneficial resource application at the moment is improving the python support & reducing the bar to adding python tests to drive adoption. I'd also like to note that the current state of the things is not contrary to the "pytest instead of ATF" idea. It should be notably easier to convert the tests to the "original" pytest format once desired than migrating the shell script mess.

Jan 11 2023, 1:34 PM
melifaro accepted D38021: pytest: Add an IPv4 loopback address.
Jan 11 2023, 9:04 AM

Jan 10 2023

melifaro added a comment to D38015: inpcb: immediately return matching pcb on lookup.
In D38015#863418, @ae wrote:

we can't recover why would we ever have identical 4-tuples in the hash

One example JFYI, IPv6 link-local addresses can be the same for different interfaces. I think this isn't the case for now, since we keep them in embedded form, but it would work in proper way in the future and we should be able to handle several the same 4-tuple but with different scope zone id.

That's a good point. There indeed shouldn't be a problem with an embedded form. When we eliminate the embedded form, that shouldn't be a problem either: inpcbs assume unicast addresses and the only scope in unicast is link-local.
There is already the ifnet argument in the in6_pcblookup_hash_locked(), so converting it to the "normal" form will require and additional condition, checking inp scopeid with the ifp scopeid.

Jan 10 2023, 11:18 AM

Jan 9 2023

melifaro accepted D37993: ifnet/API: Change if_set*bit accessors to clear first.
Jan 9 2023, 8:09 PM

Jan 8 2023

melifaro committed rG9408f36627b7: testing: fix skipping netlink tests if netlink module is not loaded. (authored by melifaro).
testing: fix skipping netlink tests if netlink module is not loaded.
Jan 8 2023, 7:53 PM
melifaro committed rGc1871a3372e3: netlink: improve RTM_GETADDR handling. (authored by melifaro).
netlink: improve RTM_GETADDR handling.
Jan 8 2023, 3:07 PM
melifaro closed D37970: netlink: improve RTM_GETADDR handling..
Jan 8 2023, 3:07 PM

Jan 7 2023

melifaro added a comment to D22012: Import dhcpcd(8) into FreeBSD base..

Thank you for the clarification! Just to check: the relevant change Is commit @ 30 Aug, right? This looks like a regression, but the commit description looks a bit vague. I wasn't able to find any bug report or message in the ML. Did you / @roy_marples.name reported it? If that's a regression, maybe something can be change on the kernel side, so dhcp 10 is not exactly a blocker.

It is a regression in FreeBSD-14. I updated my VM to the latest FreeBSD-current and the issue is still there.
I didn't report it to any ML as I'm happier with the new code in dhcpcd-10.
In a nutshell it seems like the dhcpcd privileged process seems to be under capsicum control for *some* operations but not others and some in kernel message buffers seem to shrink as writev reports message too long.
The same code works fine on FreeBSD-13.

Happy to discuss this elsewhere?

Sure! I guess the best-suited platform for that would be our bugzilla - as I guess we need to get sort of a repro (or at least more detailed description) and go from here. Do you mind submitting something?

Jan 7 2023, 7:59 PM

Jan 6 2023

melifaro added a comment to D37902: testing: add python test examples..

A "test_case_cleanup" method would work. But it would be more Pythonic if it were a teardown method. Would that be possible?

Whoops. Sorry, I missed that comment. It landed as "cleanup_test_case" to mimic the generic "cleanup" method that already exists. That method was modelled after kuya.
I tried to make the framework abstracted from kuya/atf, but that part indeed slipped through the cracks. I'll come up with a separate renaming review next week if the time permits.
Meanwhile the per-test cleanups landed, with an example provided in this diff. Hope it does work for you :-)

Raised D37971 to rename the method.

Jan 6 2023, 8:37 PM
melifaro updated the summary of D37971: testing: change python ATF cleanup handlers to be more pythonic.
Jan 6 2023, 8:36 PM
melifaro requested review of D37971: testing: change python ATF cleanup handlers to be more pythonic.
Jan 6 2023, 8:35 PM
melifaro accepted D37960: tests: add test for ipfw fwd localaddr,port.
Jan 6 2023, 8:16 PM
melifaro updated the summary of D37970: netlink: improve RTM_GETADDR handling..
Jan 6 2023, 8:13 PM
melifaro updated the diff for D37970: netlink: improve RTM_GETADDR handling..

.

Jan 6 2023, 8:12 PM
melifaro requested review of D37970: netlink: improve RTM_GETADDR handling..
Jan 6 2023, 8:07 PM
melifaro committed rG13214c601a49: netlink: fix ifaddr reporting. (authored by melifaro).
netlink: fix ifaddr reporting.
Jan 6 2023, 7:19 PM

Jan 5 2023

melifaro added a comment to D22012: Import dhcpcd(8) into FreeBSD base..

Sorry for not providing an update on this sooner.
The summary is I was waiting on the next release of dhcpcd before proceeding with importing it into base.
The reason was a regression related to capsicum was noticed with FreeBSD-14 starting in August 2022 where the privilged process could no longer write to the routing table. This issue isn't occurring on FreeBSD-13, nor FreeBSD-14 from 2021.

Thank you for the clarification! Just to check: the relevant change Is commit @ 30 Aug, right? This looks like a regression, but the commit description looks a bit vague. I wasn't able to find any bug report or message in the ML. Did you / @roy_marples.name reported it? If that's a regression, maybe something can be change on the kernel side, so dhcp 10 is not exactly a blocker.

@roy_marples.name found and fixed the issue in dhcpcd, but only in what will become dhcpcd-10 (it's too invasive for dhcpcd-9 at this point which is the stable branch).
The dhcpcd-10 has been delayed a bit, since Roy has a few health issues that are his priority right now.
That said, I'm still hoping this can be merged into FreeBSD-14 before the code slush begins on 25th April 2023.

Jan 5 2023, 10:59 AM

Jan 3 2023

melifaro added a comment to D37923: testing: handling non-root users with VNETs in pytests..

It also means that an unprivileged user won't be able to simply type "kyua test ..." and expect the unprivileged test cases to work.

I'll retry everything tomorrow, but in this regard, things are working as expected.
Unprivileged users:

  • Can run unprivileged test cases
  • root test cases are skipped
  • VNET test cases are skipped entirely (because an unprivileged user cannot create jails)

What is not working for me, is:

class TestVnetSimple(SingleVnetTestTemplate):
    @pytest.mark.parametrize(
        "user_tuple",
        [
            pytest.param(
                ["kldload if_epair", "module already loaded or in kernel"],
                marks=pytest.mark.require_user("root"),
                id="root",
            ),
            pytest.param(
                ["kldload if_epair", "Operation not permitted"],
                marks=pytest.mark.require_user("unprivileged"),
                id="unprivileged",
            ),
        ],
    )
    def test_parametrize_require_user(self, user_tuple):
        command, output = user_tuple
        assert output in subprocess.getoutput(command)

Specifically the test_parametrize_require_user[root] parameter. It gets an Operation not permitted error, as if unprivileged.
If you s/SingleVnetTestTemplate/BaseTest everything works as expected.

Thank you for testing & catching the issue!
I'll check this case and update the diff.

Jan 3 2023, 11:36 AM
melifaro added a comment to D37923: testing: handling non-root users with VNETs in pytests..

I find this confusing. It's weird that Kyua handles some of the test case isolation, and Python handles other parts. It also means that an unprivileged user won't be able to simply type "kyua test ..." and expect the unprivileged test cases to work. It seems like either the vnet stuff needs to be moved up into Kyua itself, or the privilege dropping needs to be moved down out of the runner and into the test class. In the latter case, the test case would still have a "require.user root", but could use some other decorator or just the class setup to drop privileges.

Yep, that's a good observation! I'm happy to work towards making more "native" and less confusing.

Jan 3 2023, 11:33 AM

Jan 1 2023

melifaro closed D37902: testing: add python test examples..
Jan 1 2023, 3:31 PM
melifaro committed rG8161b823d77f: testing: add python test examples (authored by melifaro).
testing: add python test examples
Jan 1 2023, 3:31 PM
melifaro updated the diff for D37923: testing: handling non-root users with VNETs in pytests..

Fix skipped tests.

Jan 1 2023, 2:32 PM
melifaro added reviewers for D37923: testing: handling non-root users with VNETs in pytests.: tests, asomers, jlduran_gmail.com, network.
Jan 1 2023, 2:30 PM
melifaro added a comment to D37902: testing: add python test examples..

I'm going to commit it as is for now and address the remaining issue in the follow-up commits.

Jan 1 2023, 2:29 PM
melifaro added a comment to D37902: testing: add python test examples..

A "test_case_cleanup" method would work. But it would be more Pythonic if it were a teardown method. Would that be possible?

Whoops. Sorry, I missed that comment. It landed as "cleanup_test_case" to mimic the generic "cleanup" method that already exists. That method was modelled after kuya.
I tried to make the framework abstracted from kuya/atf, but that part indeed slipped through the cracks. I'll come up with a separate renaming review next week if the time permits.
Meanwhile the per-test cleanups landed, with an example provided in this diff. Hope it does work for you :-)

Jan 1 2023, 2:27 PM
melifaro updated the diff for D37902: testing: add python test examples..

Uncomment unprivileged-user
Add example with the test cleanup

Jan 1 2023, 2:17 PM
melifaro committed rGbb60d265c982: testing: fix tests without cleanup in pytest. (authored by melifaro).
testing: fix tests without cleanup in pytest.
Jan 1 2023, 2:14 PM
melifaro requested review of D37923: testing: handling non-root users with VNETs in pytests..
Jan 1 2023, 1:17 PM

Dec 31 2022

melifaro committed rG89ffac3b01fb: testing: allow custom test cleanup handlers in pytest (authored by melifaro).
testing: allow custom test cleanup handlers in pytest
Dec 31 2022, 4:28 PM

Dec 30 2022

melifaro added inline comments to D37902: testing: add python test examples..
Dec 30 2022, 8:06 PM
melifaro added inline comments to D37902: testing: add python test examples..
Dec 30 2022, 8:05 PM
melifaro added a comment to D37902: testing: add python test examples..

This looks great. I especially like the ability to parameterize test cases, which isn't easy with atf-sh-api or atf-c-api. What about cleanup? I think atf-python tests need to do that differently, right? It would be good to add an example for that.

Thank you!
Yes, the cleanup is different from the native pytest approach. The initial driving usecase was to enable cheap VNET-run tests, where the cleanup procedures are fixed - you need to remove the jail & interfaces. That part is done automatically by the framework.

While on this topic, the cleanup for the native pytest approach is done the "old" way. I have encountered a few races, where an epair interface remains after a massive test failure. In other words, I was contemplating the possibility of adapting 80fc25025ffcb0d369fc0b6d4d272ad6fd3f53c3, which destroys the epair assigned to the vnet from inside the jail. Obviously, this has nothing to do with this introductory tutorial.

Yep, thanks for reminding! There is a known problem resulting from a corner case in the kernel delayed object reclamation model. I promised glebius@ to alter the mechanism as a workaround, but haven't done it yet. That's something that indeed needs to happen. I'll fix this in a day or two.

Dec 30 2022, 7:56 PM
melifaro added a comment to D37902: testing: add python test examples..

This looks great. I especially like the ability to parameterize test cases, which isn't easy with atf-sh-api or atf-c-api. What about cleanup? I think atf-python tests need to do that differently, right? It would be good to add an example for that.

Thank you!
Yes, the cleanup is different from the native pytest approach. The initial driving usecase was to enable cheap VNET-run tests, where the cleanup procedures are fixed - you need to remove the jail & interfaces. That part is done automatically by the framework.
I'll add a hook that'll check if the test_name_cleanup() method exists and calls it to perform the cleanup, along with the example here. Does it look reasonable to you?

Dec 30 2022, 6:16 PM
melifaro committed rG06e879593a44: routing: add missed RIB_WUNLOCK in the add_route_flags(). (authored by melifaro).
routing: add missed RIB_WUNLOCK in the add_route_flags().
Dec 30 2022, 3:55 PM
melifaro added a comment to D37902: testing: add python test examples..

Couple more nits.
New run (this time as expected):
https://cirrus-ci.com/task/5756291799842816?logs=test_examples
I'll eventually add a simple example that consumes Scapy directly (instead of doing it via a shell script).

That would be awesome!
There are quite a bunch of scapy-based tests, that are indeed mostly shell-based.

Dec 30 2022, 12:00 PM
melifaro updated the diff for D37902: testing: add python test examples..

Address comments.

Dec 30 2022, 11:57 AM

Dec 29 2022

melifaro updated subscribers of D37902: testing: add python test examples..
Dec 29 2022, 8:19 PM
melifaro updated the summary of D37902: testing: add python test examples..
Dec 29 2022, 8:19 PM
melifaro requested review of D37902: testing: add python test examples..
Dec 29 2022, 8:16 PM
melifaro committed rGf63825ff21a3: testing: improve python vnet wrapper. (authored by melifaro).
testing: improve python vnet wrapper.
Dec 29 2022, 7:59 PM
melifaro accepted D37874: jail: Use flexible array member within struct prison_ip.
Dec 29 2022, 6:00 PM
melifaro added inline comments to D37874: jail: Use flexible array member within struct prison_ip.
Dec 29 2022, 5:55 PM
melifaro added inline comments to D37874: jail: Use flexible array member within struct prison_ip.
Dec 29 2022, 5:22 PM
melifaro added a comment to D37871: jail: Fix wrong IPv[46] addresses inherited from parent jail.
In D37871#861097, @zlei wrote:

@melifaro @kp
I'd like to combine this (D37871) with D37872 , as they're simple and are same type of mistakes,
although cause different symptoms.

How shall I do ? Commit with two Differential Revision , or combine them into a new differential ?

I'd commit both separately, as it's easier to track and to reason about.

Dec 29 2022, 5:00 PM
melifaro added inline comments to D37874: jail: Use flexible array member within struct prison_ip.
Dec 29 2022, 4:58 PM

Dec 28 2022

melifaro added inline comments to D37874: jail: Use flexible array member within struct prison_ip.
Dec 28 2022, 6:07 PM
melifaro accepted D37890: jail: Improve readability.
Dec 28 2022, 6:02 PM
melifaro accepted D37872: jail: Properly restrict the child jail's IPv[46] addresses.
Dec 28 2022, 5:58 PM
melifaro added inline comments to D37874: jail: Use flexible array member within struct prison_ip.
Dec 28 2022, 5:49 PM
melifaro added a comment to D37894: atf_pytest_wrapper: Avoid truncation when longer output.

Thank you for the patch!

@melifaro, do you take GitHub pull requests? This review was originally two commits, one for the style fixes, another for the actual "fix".

Just in case - it's possible to create a review with multiple commits.

I believe it is safe to leave always with -vv?, as it matches the other ATF output.

I'm not sure I have the notifications configured, but let's try.

Dec 28 2022, 5:38 PM
melifaro committed rG058ac3e80633: atf_pytest_wrapper: fix pytest output truncation (authored by jlduran_gmail.com).
atf_pytest_wrapper: fix pytest output truncation
Dec 28 2022, 5:34 PM
melifaro closed D37894: atf_pytest_wrapper: Avoid truncation when longer output.
Dec 28 2022, 5:34 PM
melifaro committed rGeaeebfcb3859: pytest: silence deprecation warning in the pytest atf wrapper (authored by jlduran_gmail.com).
pytest: silence deprecation warning in the pytest atf wrapper
Dec 28 2022, 3:56 PM
melifaro closed D37884: pytest: Silence deprecation warning.
Dec 28 2022, 3:56 PM

Dec 27 2022

melifaro accepted D37884: pytest: Silence deprecation warning.

Thank you!
Will commit tomorrow

Dec 27 2022, 10:14 PM
melifaro added inline comments to D37871: jail: Fix wrong IPv[46] addresses inherited from parent jail.
Dec 27 2022, 8:47 PM
melifaro added a comment to D37872: jail: Properly restrict the child jail's IPv[46] addresses.

It would be nice to have the test script similar to the one in the testing section in our auto tests/.
Jails are complex beasts, so increasing the covered code scope would help detect regressions faster

Dec 27 2022, 8:45 PM
melifaro accepted D37874: jail: Use flexible array member within struct prison_ip.
Dec 27 2022, 8:40 PM

Dec 26 2022

melifaro added inline comments to D37876: ping_tests: Introduce a script to test ping.
Dec 26 2022, 6:44 PM
melifaro added a comment to D37876: ping_tests: Introduce a script to test ping.

Any thoughts of using native python interface instead of the shell wrappers?

That looks nice!, but do you mean using pytest instead of atf-sh(3), or instead of using subprocess.run to execute shell commands?

Pytest. There is a wrapper that automatically wraps pytest tests into kyua interface, allowing to run them in a standard system test way via kuya.

Dec 26 2022, 6:01 PM
melifaro added a comment to D37874: jail: Use flexible array member within struct prison_ip.
In D37874#860475, @zlei wrote:

This is a request by @melifaro in D37732 .

LGTM!
Do you think it would be possible to convert PR_IP to be static inline function, so that kind of erros are spotted by the compiler?

I'll take a look at that. Smart compilers help a lot ;)

Thank you!

Dec 26 2022, 2:39 PM
melifaro added a comment to D37876: ping_tests: Introduce a script to test ping.

Thank you for working on this!
Any thoughts of using native python interface instead of the shell wrappers?
Just in case, the examples can be found in tests/sys/net/routing/test_rtsock_multipath.py or tests/sys/netlink/test_rtnl_iface.py

Dec 26 2022, 1:10 PM

Dec 24 2022

melifaro added a comment to D37783: netlink: add netlink to GENERIC.

If there are no objections, I will commit it on Monday, December 26.

Dec 24 2022, 11:32 AM
melifaro added a comment to D36529: netstat: make netstat -rn use netlink instead of rtsock.
In D36529#858749, @gbe wrote:

@melifaro thanks for the differential. I remember darkly, that there was PR a few month ago, that FreeBSD doesn't support "route print" like most operating systems do. Would it be possible to integrate that feature of that differential and netlink?

Generally I'm not opposed to the idea. There are a number of things to be sorted out, though. For example, what should be the column format, should it be machine-readable (as currently /sbin/route does not have any lib depenencies) and so on.
I guess the easiest would be to do execve /usr/sbin/netstat -[46]rn on route print inside route(8) if so desired. That should be pretty straight-forwarded to implement. I'm not sure I'll have cycles to do this ATM, as I'm full-hands in Netlink conversion. I'm happy to review such change if somebody else comes up with the patch.

Dec 24 2022, 11:23 AM
melifaro added a comment to D37784: ifnet/DrvAPI: Move if_t typedef to a better place.

Q: What blockers prevent moving the accessors outside of if_var.h?

Nothing, really. Just doing this piecemeal. I noticed in some of my conversions that keeping the if_t typedef in if_var.h necessitated pulling it in where it wasn't needed beyond getting if_t, so pulled it out. The current users of struct ifnet beyond a forward declaration already include if_var.h so there's no gain or loss there.

Got it, make sense. Do you have any tentative timeline in mind for the stage when these accessors can be moved outside if_var.h ?

Once all the drivers are converted over, so hoping to have it all done by end of January. I've got a work in progress, but tons of build failures. Seems drivers love to include in_var.h, in6_var.h, etc. Those will be hard to pull out, so will take some time.

Thank you for the clarification! No rush, just wanted to ensure we are on the same page w.r.t. reducing if_var.h header usage.

Dec 24 2022, 11:12 AM
melifaro added a comment to D37757: WIP: Add scalable route caching framework.
In D37757#860208, @zlei wrote:
struct route_cache {
  union {
   struct route ro;
   struct route_in ro_in;
   struct route_in6 ro_in6
  }
 struct mtx lock;
 struct rib_subscription *rs;
}

Does the lock protect the read part ?
If yes then it is apparent a contention when concurrent network IO occurs.

No, the update fucnction, which uses the lock, is inly called when it is needed to update the cache.
The read path is not affected.

Let me clarify it a bit further. The idea is change the parts of the stack that currently update nhop/lle cache in the struct route directly to use the new callback.
The hot/data/read part remains unaffected - no atomic or other ops are added.
When route cache is invalidated (route_cache_invalidate() clearing the pointer) datapath may read old nhop/lle pointer. It is safe, as both nhop and lles use epoch-backed garbage collection.

Dec 24 2022, 11:07 AM

Dec 23 2022

melifaro added inline comments to D37862: ifcapnv: fix IFCAP2 usage.
Dec 23 2022, 6:19 PM
melifaro committed rGc89209c674f2: netlink: fix test-includes broken by f2c8381fce9b (authored by melifaro).
netlink: fix test-includes broken by f2c8381fce9b
Dec 23 2022, 5:59 PM
melifaro added a comment to D37757: WIP: Add scalable route caching framework.
In D37757#860208, @zlei wrote:
struct route_cache {
  union {
   struct route ro;
   struct route_in ro_in;
   struct route_in6 ro_in6
  }
 struct mtx lock;
 struct rib_subscription *rs;
}

Does the lock protect the read part ?
If yes then it is apparent a contention when concurrent network IO occurs.

No, the update fucnction, which uses the lock, is inly called when it is needed to update the cache.
The read path is not affected.

Dec 23 2022, 5:10 PM
melifaro committed rG3e3875413128: netlink: make snl(3) headers self-contained. (authored by melifaro).
netlink: make snl(3) headers self-contained.
Dec 23 2022, 3:53 PM
melifaro committed rGc9313a0bad68: netlink: allow netlink to be build in the kernel (authored by melifaro).
netlink: allow netlink to be build in the kernel
Dec 23 2022, 3:27 PM
melifaro closed D37781: netlink: allow netlink to be build in the kernel.
Dec 23 2022, 3:27 PM
melifaro committed rGf6f4ba0b05ab: netlink: fix netlink_snl_route.h header includes (authored by melifaro).
netlink: fix netlink_snl_route.h header includes
Dec 23 2022, 3:27 PM
melifaro committed rGf2c8381fce9b: netlink: add snl(3) - simple netlink library (authored by melifaro).
netlink: add snl(3) - simple netlink library
Dec 23 2022, 3:03 PM
melifaro closed D37736: netlink: add snl(3) - simple netlink library.
Dec 23 2022, 3:03 PM
melifaro added a comment to D37736: netlink: add snl(3) - simple netlink library.
In D37736#859376, @bapt wrote:

I manage to convert my code to use snl.h its ok for me.

Awesome!

Quick remarks, I plan to add snl_genl.h for genl specific case, would that be ok for you?

Of course.

Doesn't the routing specific part needs to be moved to a snl_route.h?

Yep, that makes sense. Moved to netlink_snl_route.h.

Dec 23 2022, 2:58 PM