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

Non-existent conf-cancel #5

Closed
bkauler opened this Issue Feb 7, 2019 · 7 comments

Comments

Projects
None yet
2 participants
@bkauler
Copy link

bkauler commented Feb 7, 2019

Hi, the ifmon manpage refers to spawning /etc/net/conf-cancel, however, I cannot find it in the source code.

There is conf-release, so I presume that is what is intended.

If I plug in a ethernet cable, conf-request is called. Fine, but unplugging the cable does nothing. Neither conf-cancel nor conf-release are called.

I changed this line in /etc/net/mode-lan0, thinking that is needed to recognize cable being unplugged:

#ifctl $1 auto-dhcp
ifctl $1 dhcp-once

But no, makes no difference.

Have I missed understanding something?

@arsv

This comment has been minimized.

Copy link
Owner

arsv commented Feb 7, 2019

Oh, yeah, it's definitely conf-release. I think I need to update the docs on this.
If it's not getting called it may actually be bug.

conf-release only gets called if conf-request has exited successfully. This is to allow continuous-mode dhcp clients, like dhcp $interface within minibase, that do not exit on their own and need to be killed to release the address. Other than that, it should work.

dhcp-once is probably not what you want for a wired connection. It works just like auto-dhcp for the first carrier-up and the first subsequent carrier-down event. The second carrier-up and any carrier events after that will be ignored. This is meant for WPA (Wi-Fi) links.

@arsv

This comment has been minimized.

Copy link
Owner

arsv commented Feb 7, 2019

Sorry, my bad, it should be conf-cancel throughout.
This script gets called after the carrier has gone down, by which point it's too late release the address.

It seems to work well for me, conf-cancel gets called when the cable is pulled.

If you have iproute2 installed, the bit it reacts to is LOWER_UP from ip link output.

@bkauler

This comment has been minimized.

Copy link
Author

bkauler commented Feb 8, 2019

OK, fixed that, now all working.

Note, I applied a patch, changed /var/interfaces to /var/local/interfaces, as in easyOS /var is a tmpfs, with only certain sub-directories persistent (such as /var/local). But you don't have to do that, it is easy enough to apply the patch before compiling.

Also /run is a tmpfs, so I have to create /run/ctrl prior to running ifmon.

I have posted a progress report to my blog, kindly let me know if anything is wrong in it:

http://bkhome.org/news/201902/basic-ethernet-setup-with-minibase.html

@arsv

This comment has been minimized.

Copy link
Owner

arsv commented Feb 8, 2019

Regarding /sbin/service, that was for minibase-br, and most likely it won't stay like that. The exact path is not important, all tools should work fine regardless of where they are installed.

For a system with a more conventional fs tree layout, dumping everything into /sbin probably makes more sense than keeping /sbin/service.

I'm not sure I get the idea behind /etc/net/identify, but it wasn't supposed to look like that. In pretty much all cases it should be just ifctl $1 identify, nothing else. ifctl ... mode ... is only meant to be run interactively by the user, definitely not from a profile script. Also those "+++" are debug output, probably shouldn't be there as well.

That profile script should probably be called "mode-lan", without the 0 part. It's not a second name for interface, it's more like the role of the device in the system. At least that's what it was meant to be.

Let's say there's a box with four Ethernet interfaces: one uplink to the ISP, two going to local boxes A and B, and one unused. The expected output of ifctl should be something like this:

eth0: A
eth1: uplink
eth3: B

with appropriate setup scripts.

I think I need to work a bit more on the documentation.

Also /run is a tmpfs, so I have to create /run/ctrl prior to running ifmon.

Yes, that's exactly how it's supposed to be done.
minibase-br does mkdir right after mounting /tmp.

@bkauler

This comment has been minimized.

Copy link
Author

bkauler commented Feb 8, 2019

Ha ha, yes, I wondered if I was being a bit too "creative" with /etc/net/identify. I will think about that some more, and likely modify that blog post soon.

Notice though, although eth0 is assigned to lan0, etc., /etc/net/mode-lan is only copied to /etc/net/mode-lan0 if the latter doesn't exist. It is just creating a default behaviour, in case the user hasn't manually created such a script.
But, yeah, I can see that such automatic behaviour might not be desirable. I am thinking "inside the box", just my own setup, where I always use dhcp.

Also, I take your point about "eth0: A", but I didn't see, for myself anyway, any problem with always assigning "eth0: lan0", regardless of what I intended to use lan0 for.
What would probably be nice, in a use interface that manages this, the ability to rename the assignment. I tried rerunning:

# ifctl eth1 mode B
ifctl: EALREADY

I don't know if you would consider it worthwhile to have something like "ifctl lan1 rename B". Even an option to remove the assignment.

Thanks for the feedback.

@arsv

This comment has been minimized.

Copy link
Owner

arsv commented Feb 9, 2019

Ah, got it, default profiles. Well, if it works, then ok I guess.
My idea was that the default setting should be (no profile), which in turn means no script.

ifctl eth1 stop; ifctl eth1 mode B to change profile.
ifctl eth1 stop removes profile.

@bkauler

This comment has been minimized.

Copy link
Author

bkauler commented Feb 17, 2019

Ok, closing.

@bkauler bkauler closed this Feb 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment