A few changes to the Hurd port based on hooks#677
Conversation
It also clears the interface configuration when `persistent` is false
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| trans=$(showtrans /servers/socket/2 2>/dev/null) | ||
| [ -z "$trans" ] && trans=$(fsysopts /servers/socket/2 2>/dev/null) | ||
|
|
||
| case "$trans" in | ||
| */pfinet" "*|*/lwip" "*) hurd_net=true;; | ||
| *) hurd_net=false;; |
There was a problem hiding this comment.
A few changes here:
showtransonly returns passive translators, that is, when the directory entry in the FS has a record to execute the translator when the first RPC is received. However, we can also have active translators running in a node that are not installed as passive translators. Those are detected byfsysopts.- Now it also detects
lwip. I made some changes in the lwip translator so it mimics how pfinet responds to fsysopts. I'll send the patches to the hurd mailing list. But since now they are compatible, we can reuse the same hook from both. - The pattern has been modified a bit so translators are detected also out of their default path at
/hurd/*.
| fsysopts /servers/socket/2 -i "$ifxname" \ | ||
| -a "$new_ip_address" $flags | ||
| elif $if_down; then | ||
| elif $if_down || { [ "$reason" = STOPPED ] && ! $if_persistent; }; then |
There was a problem hiding this comment.
In my previous patches, which configured lwip/pfinet via ioctls, having persistent == false and release == false made dhcpcd unconfigure the interface on exit. However, this doesn't work when using the hook. With the hook, release == true unconfigures the stack in the kernel on exit but persistent == false + release == false doesn't. IMO it makes more sense to unconfigure always when persistent == false, and it seems to mimic how BSD behaves. Or am I missing something?
| if (efprintf(fp, "if_persistent=%s", | ||
| ifo->options & DHCPCD_PERSISTENT ? "true" : "false") == -1) | ||
| goto eexit; |
There was a problem hiding this comment.
Just a new var so the pfinet hook knows the value of the persistent option
| hurd*) | ||
| echo "CPPFLAGS+= -D_GNU_SOURCE" >>$CONFIG_MK | ||
| echo "DHCPCD_SRCS+= if-hurd.c" >>$CONFIG_MK | ||
| echo "LDADD+= -lpthread" >>$CONFIG_MK |
There was a problem hiding this comment.
For some reason this is not added automatically in my local environment. It could be just my box, if it complies for you in the Hurd without it, this is probably not needed.
This adds a few changes to the pfinet hook. I'll explain further in comments below.