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)
Fri, Jan 3, 12:04 AM
Unknown Object (File)
Wed, Dec 25, 8:50 PM
Unknown Object (File)
Wed, Dec 18, 5:46 PM
Unknown Object (File)
Dec 2 2024, 9:33 AM
Unknown Object (File)
Nov 7 2024, 12:15 PM
Unknown Object (File)
Sep 30 2024, 7:37 AM
Unknown Object (File)
Sep 27 2024, 4:46 AM
Unknown Object (File)
Sep 23 2024, 4:39 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.