Bug 195552

Summary: [patch] fix AF_UNSPEC handling in casper DNS limits
Product: Base System Reporter: mp39590
Component: kernAssignee: Mariusz Zaborski <oshogbo>
Status: Open ---    
Severity: Affects Some People CC: emaste, oshogbo
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch none

Description mp39590 2014-12-01 11:54:51 UTC
Created attachment 150065 [details]
patch

Currently, if we set AF_UNSPEC as a limit for DNS service in casper it
won't allow us to issue any requests.

Code responsible for this check looks like this:

@ static bool
@ dns_allowed_family(const nvlist_t *limits, int family)
@ {
@         [...]
@         while ((name = nvlist_next(limits, NULL, &cookie)) != NULL) {
@                  if (strncmp(name, "family", sizeof("family") - 1) != 0)
@                           continue;
@                  nofamilies = false;
@                  if (family == AF_UNSPEC)
@                           continue;
@                  if (nvlist_get_number(limits, name) == (uint64_t)family)
@                           return (true);
@         }
@         [...]
@         if (nofamilies)
@                  return (true);
@
@         return (false);
@ }

Attached patch changes this behavior to following one: if limit nvlist contain AF_UNSPEC any family is allowed.
Comment 1 Mariusz Zaborski freebsd_committer freebsd_triage 2016-02-07 21:11:55 UTC
I didn't notice this PR.
I will take it.