Message ID | 20160830011645.25769-11-zackw@panix.com |
---|---|
State | Superseded |
Headers |
Received: (qmail 23561 invoked by alias); 30 Aug 2016 01:16:51 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <libc-alpha.sourceware.org> List-Unsubscribe: <mailto:libc-alpha-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:libc-alpha-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 23445 invoked by uid 89); 30 Aug 2016 01:16:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=resistance, __throw, __THROW, H*MI:sk:2016083 X-HELO: l2mail1.panix.com From: Zack Weinberg <zackw@panix.com> To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com Subject: [PATCH 10/13] Installed-header hygiene (BZ#20366): struct ether_addr. Date: Mon, 29 Aug 2016 21:16:42 -0400 Message-Id: <20160830011645.25769-11-zackw@panix.com> In-Reply-To: <20160830011645.25769-10-zackw@panix.com> References: <20160830011645.25769-1-zackw@panix.com> <20160830011645.25769-2-zackw@panix.com> <20160830011645.25769-3-zackw@panix.com> <20160830011645.25769-4-zackw@panix.com> <20160830011645.25769-5-zackw@panix.com> <20160830011645.25769-6-zackw@panix.com> <20160830011645.25769-7-zackw@panix.com> <20160830011645.25769-8-zackw@panix.com> <20160830011645.25769-9-zackw@panix.com> <20160830011645.25769-10-zackw@panix.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit |
Commit Message
Zack Weinberg
Aug. 30, 2016, 1:16 a.m. UTC
Some versions of netinet/if_ether.h only define struct ether_addr when __USE_MISC. This breaks function prototypes in netinet/ether.h that depend on it. The path of least resistance is to condition those declarations on __USE_MISC too. * inet/netinet/if_ether.h: Condition all function prototypes on __USE_MISC, to ensure struct ether_addr is declared. --- inet/netinet/ether.h | 2 ++ 1 file changed, 2 insertions(+)
Comments
On 08/29/2016 09:16 PM, Zack Weinberg wrote: > Some versions of netinet/if_ether.h only define struct ether_addr when > __USE_MISC. This breaks function prototypes in netinet/ether.h that > depend on it. The path of least resistance is to condition those > declarations on __USE_MISC too. > > * inet/netinet/if_ether.h: Condition all function prototypes > on __USE_MISC, to ensure struct ether_addr is declared. You need to explain this in more detail please. A quick review shows struct ether_addr is not guarded by __USE_MISC e.g. sysdeps/generic/netinet/if_ether.h sysdeps/unix/sysv/linux/net/ethernet.h Under exactly what conditions is this cleaning up the headers? > --- > inet/netinet/ether.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/inet/netinet/ether.h b/inet/netinet/ether.h > index 3dff523..0952b23 100644 > --- a/inet/netinet/ether.h > +++ b/inet/netinet/ether.h > @@ -24,6 +24,7 @@ > /* Get definition of `struct ether_addr'. */ > #include <netinet/if_ether.h> > > +#ifdef __USE_MISC > __BEGIN_DECLS > > /* Convert 48 bit Ethernet ADDRess to ASCII. */ > @@ -49,5 +50,6 @@ extern int ether_line (const char *__line, struct ether_addr *__addr, > char *__hostname) __THROW; > > __END_DECLS > +#endif /* Use misc. */ > > #endif /* netinet/ether.h */ >
On 08/29/2016 09:16 PM, Zack Weinberg wrote: > Some versions of netinet/if_ether.h only define struct ether_addr when > __USE_MISC. This breaks function prototypes in netinet/ether.h that > depend on it. The path of least resistance is to condition those > declarations on __USE_MISC too. > > * inet/netinet/if_ether.h: Condition all function prototypes > on __USE_MISC, to ensure struct ether_addr is declared. Wrong ChangeLog path? LGTM. Linux does define an if_ether.h, but it uses struct ethhdr instead which doesn't conflict.
On Wed, Sep 21, 2016 at 3:51 PM, Carlos O'Donell <carlos@redhat.com> wrote: > On 08/29/2016 09:16 PM, Zack Weinberg wrote: >> Some versions of netinet/if_ether.h only define struct ether_addr when >> __USE_MISC. This breaks function prototypes in netinet/ether.h that >> depend on it. The path of least resistance is to condition those >> declarations on __USE_MISC too. >> >> * inet/netinet/if_ether.h: Condition all function prototypes >> on __USE_MISC, to ensure struct ether_addr is declared. > > Wrong ChangeLog path? Yes, that should've been inet/netinet/ether.h. You may have already figured this out for yourself, but for the record: There are two versions of netinet/if_ether.h in the tree: ./sysdeps/generic/netinet/if_ether.h ./sysdeps/unix/sysv/linux/netinet/if_ether.h (There is also sysdeps/mach/hurd/net/if_ether.h but that appears to be an unrelated header - note it's in net/ instead of netinet/ - it defines approximately the same things that uapi <linux/if_ether.h> does.) The generic netinet/if_ether.h defines struct ether_addr unconditionally. The Linux-specific version, however, defines it only under __USE_MISC (by conditionally including <net/ethernet.h> ... this sure is a twisty little maze of subtly different headers, isn't it?) inet/netinet/ether.h includes <netinet/if_ether.h> and then expects struct ether_addr to be available. And that's where we came in. zw
diff --git a/inet/netinet/ether.h b/inet/netinet/ether.h index 3dff523..0952b23 100644 --- a/inet/netinet/ether.h +++ b/inet/netinet/ether.h @@ -24,6 +24,7 @@ /* Get definition of `struct ether_addr'. */ #include <netinet/if_ether.h> +#ifdef __USE_MISC __BEGIN_DECLS /* Convert 48 bit Ethernet ADDRess to ASCII. */ @@ -49,5 +50,6 @@ extern int ether_line (const char *__line, struct ether_addr *__addr, char *__hostname) __THROW; __END_DECLS +#endif /* Use misc. */ #endif /* netinet/ether.h */