Bug 195552 - [patch] fix AF_UNSPEC handling in casper DNS limits
Summary: [patch] fix AF_UNSPEC handling in casper DNS limits
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Mariusz Zaborski
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2014-12-01 11:54 UTC by mp39590
Modified: 2016-02-07 21:11 UTC (History)
2 users (show)

See Also:


Attachments
patch (891 bytes, patch)
2014-12-01 11:54 UTC, mp39590
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 2016-02-07 21:11:55 UTC
I didn't notice this PR.
I will take it.