Bug 182466 - [headers] [patch] make <resolv.h> self-contained
Summary: [headers] [patch] make <resolv.h> self-contained
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: Normal Affects Some People
Assignee: freebsd-bugs (Nobody)
Keywords: easy, needs-qa, standards
Depends on:
Reported: 2013-09-28 20:30 UTC by Jan Beich
Modified: 2018-07-04 09:54 UTC (History)
3 users (show)

See Also:
koobs: mfc-stable11?
koobs: mfc-stable10?

res.diff (648 bytes, patch)
2013-09-28 20:30 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2013-09-28 20:30:00 UTC
Our resolv.h already includes a bunch of headers listed in resolver(3)
man page. Make the list complete by adding netinet/in.h for sockaddr_in.

This should reduce patching required when porting code written with
Linux or NetBSD in mind.

reinstating kern/85741

How-To-Repeat: $ cat a.c
#include <resolv.h>
int main() { return 0; }

$ cc a.c
In file included from a.c:1:
/usr/include/resolv.h:157:14: error: array has incomplete element type
      'struct sockaddr_in'
                nsaddr_list[MAXNS];     /*%< address of name server */
/usr/include/resolv.h:156:9: note: forward declaration of 'struct sockaddr_in'
        struct sockaddr_in
/usr/include/resolv.h:171:18: error: field has incomplete type 'struct in_addr'
                struct in_addr  addr;
/usr/include/resolv.h:171:10: note: forward declaration of 'struct in_addr'
                struct in_addr  addr;
/usr/include/resolv.h:195:21: error: field has incomplete type 'struct sockaddr_in'
        struct sockaddr_in      sin;
/usr/include/resolv.h:156:9: note: forward declaration of 'struct sockaddr_in'
        struct sockaddr_in
3 errors generated.
Comment 1 Herbert J. Skuhra 2017-12-13 12:06:08 UTC

I am trying to build Asterisk 15.1.3 on 12.0-CURRENT (r326622) and the configure script fails with this error while checking for resolv.h.

Applying Jan's patch resolves the issue. Why hasn't this been committed yet?


Comment 2 Herbert J. Skuhra 2018-01-12 09:58:21 UTC
NetBSD did exactly this in

revision 1.40
date: 2012-11-07 16:45:24 +0100;  author: christos;  state: Exp;  lines: +2 -1;
add <netinet/in.h> because it is needed for sockaddr_in.
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2018-07-04 08:01:47 UTC
Reset status (cant be in progress without 'real' assignee).

CC askterisk maintainer
Comment 4 Guido Falsi freebsd_committer 2018-07-04 09:54:51 UTC
I have no objection.

I have not seen the reported failure in the asterisk ports, but I have never tested the specific version reported here. Present versions of the asterisk ports (13 and 15) work fine and I don't see this impacting them.