Page MenuHomeFreeBSD

Create dhclient pid directory if it doesn't exist
ClosedPublic

Authored by crees on Feb 21 2021, 7:10 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 9:01 PM
Unknown Object (File)
Feb 17 2024, 3:03 AM
Unknown Object (File)
Feb 6 2024, 2:00 AM
Unknown Object (File)
Jan 18 2024, 4:06 PM
Unknown Object (File)
Jan 8 2024, 6:09 AM
Unknown Object (File)
Dec 21 2023, 8:04 AM
Unknown Object (File)
Dec 8 2023, 11:11 AM
Unknown Object (File)
Dec 1 2023, 7:20 PM
Subscribers

Details

Summary
  • Upgrading from older FreeBSD versions can result in errors
  • /var/run can be a tmpfs, and this should be handled correctly

dhclient is hard-coded to use _dhcp and falls back to nobody if
that user doesn't exist, so mimic that behaviour here.

Test Plan

Reboot- works, and creates the dir correctly

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

crees requested review of this revision.Feb 21 2021, 7:10 PM

Hi Mark,

This was a problem starting with D16584- this is an easy fix.

Would you mind if I asked you to review/approve? Happy to find someone else if this is cheeky.

Chris

libexec/rc/rc.d/dhclient
56

If the directory is created according to the mtree specification, it'll be owned by root:wheel. In particular, dhclient drops privileges after it creates a pidfile. Why does the rc script need to deviate from what we'd get with a clean install?

You're quite right. I don't know why my /var/run/dhclient is owned like
that!

Thanks, I think this is ok. I would suggest adding a short comment explaining why we create the piddir there.

It's also not obvious to me why dhclient itself shouldn't create the directory, but I think this is a reasonable solution, assuming you intend to merge to 13.0.

This revision is now accepted and ready to land.Feb 22 2021, 8:03 PM

I don't think daemons usually create piddirs- this is very common in ports land. Usually it's because they don't have permission for /var/run, so I guess they can't, but it's certainly not out of the ordinary.

I'll commit with this comment:

  1. /var/run/dhclient is not guaranteed to exist,
  2. e.g. if /var/run is a tmpfs

Thanks for taking the time to review.

I don't think daemons usually create piddirs- this is very common in ports land. Usually it's because they don't have permission for /var/run, so I guess they can't, but it's certainly not out of the ordinary.

I'll commit with this comment:

  1. /var/run/dhclient is not guaranteed to exist,
  2. e.g. if /var/run is a tmpfs

Thanks for taking the time to review.

That sounds reasonable to me, thank you.