Wed 11 Feb 2009 08:22:34 PM UTC, comment #9:
> I expect warnings on ip_addr.h: it uses ntohl() and companion functions, which are defined in inet.h.
Ooops, missed that. It did not generate warnings, but that's because all files that use the macro include inet.h...
I've fixed that.
|
Tue 10 Feb 2009 09:39:13 PM UTC, comment #8:
Thanks Simon.
I can't test it right now, but I expect warnings on ip_addr.h: it uses ntohl() and companion functions, which are defined in inet.h.
> ip_addr.h still contains the IN_CLASS* macros, which look like
> inet.h from the prefix, but at least for me, that's OK.
They are BSD compatibility defines, so inet.h would be the "right" place. Anyway they never hurt me where they are.
|
Tue 10 Feb 2009 08:47:17 PM UTC, comment #7:
OK, I've checked in the changes requested in comment #4, but removed the dependency from ip_addr.h to inet.h. ip_addr.h still contains the IN_CLASS* macros, which look like inet.h from the prefix, but at least for me, that's OK.
Luca, awaiting your comment.
|
Tue 30 Sep 2008 01:53:48 PM UTC, comment #6:
Reopening per request.
|
Tue 30 Sep 2008 10:32:00 AM UTC, comment #5:
Ok, it's marked as closed (but it shouldn't), and it's by no means critical, but in case anybody forgot about this bug, here comes a reminder...
|
Thu 28 Aug 2008 03:18:55 PM UTC, comment #4:
Here's a patch that is a lot cleaner:
- moves INADDR_* defines to inet.h where they are more appropriate
- does not add (improper) includes in inet.c
- takes the opportunity to define INADDR_ANY and _BROADCAST
(file #16379)
|
Wed 27 Aug 2008 03:49:36 PM UTC, comment #3:
> moved declaration of struct in_addr from ip_addr.h to inet.h
I'm ok with this change, but one point is still there: ip4_addr1() and similar macros in ip_addr.h use ntohl(), which is in inet.h.
Since thanks to your change now inet.h does not need ip_addr.h anymore, the attached patch tries to go one step forward.
It simply swaps the dependancy: ip_addr.h includes inet.h and not the vice versa.
I'm not 100% satisfied because it also silently makes inet.c (not .h) dependent on ip_addr.h, but it might still be ok since ip_addr.h is mostly a bunch of macros.
Er, the patch leaves to be fixed files (if any) that include inet.h but use ip_addr.h.
(file #16367)
|
Tue 26 Aug 2008 07:47:23 PM UTC, comment #2:
-> moved declaration of struct in_addr from ip_addr.h to inet.h
|
Tue 26 Aug 2008 07:42:57 PM UTC, comment #1:
Wouldn't it be more simple to move the declaration of struct in_addr to inet.h? Seems more logical to me as this is a struct that is used for the inet_*() functions only.
|
Mon 25 Aug 2008 10:51:27 AM UTC, original submission:
ip_addr.h defines:
> #define ip4_addr1(ipaddr) ((u16_t)(ntohl((ipaddr)->addr) >> 24) & 0xff)
and other macros which use ntohl().
This generates compiler warnings: ip_addr.h should include inet.h, where ntohl() is.
But inet.h already includes ip_addr.h (for using struct in_addr)!
Idea 1: mode ntohl() and related to a new file :-(
Idea 2: reimplement ip4_addr1() without using ntohl :-S such as:
#define ip4_addr1(ipaddr) ((u16_t)((char*)((ipaddr)->addr)[0]) & 0xff)
or similar
|