[Olsr-dev] [PATCH] plugins: fix build with musl

Ferry Huberts (spam-protected)
Fri May 15 22:13:45 CEST 2015



On 15/05/15 22:08, Conrad Lara wrote:
> Any reason not to do  reverse patch next time?
>
> Push force is generally in my experience frowned upon as it can (and
> I would argue did) re-write history (though it's since been reverted
> by another push)
>

I know all about that.
Normally I only do reverts.
I did a force because the window was small enough in my judgement.


> At least in that case (if no fixing patch was done) would of been
> documented on the code history that there is a known issue with that
> particular code for someone to review in the future.
>
>
> Sent from my iPhone
>
>> On May 15, 2015, at 12:47 PM, Ferry Huberts <(spam-protected)>
>> wrote:
>>
>> I did a push force, master it back before the patches
>>
>>> On 15/05/15 21:45, Ferry Huberts wrote: Did you actually compile
>>> it...??
>>>
>>> I'm reverting now. Don't push anything until it's been reviewed
>>>
>>>
>>>> On 15/05/15 21:44, Ferry Huberts wrote: It is still not fix.
>>>> This is a mess. And now we can add linux32 to the list of
>>>> broken builds.
>>>>
>>>> I _really_ dislike build breakage.
>>>>
>>>> Either you fix it in the next patch that you are going to put
>>>> on the mailing list first, or I'll revert all of your patches.
>>>>
>>>>> On 15/05/15 21:40, Daniel Golle wrote: Sorry for the mess,
>>>>> hope this is properly addressed now by testing for __GLIBC__
>>>>> or __BIONIC__
>>>>>
>>>>>> On Fri, May 15, 2015 at 09:32:54PM +0200, Ferry Huberts
>>>>>> wrote: I would rather have people post patches on the
>>>>>> mailing list so that we (I) can review them.
>>>>>>
>>>>>> olsrd is rather complicated code in places and we build for
>>>>>> a lot of platforms, build breakage is easily obtained, as
>>>>>> demonstrated by this patch.
>>>>>>
>>>>>> I could have easily told you that before the patch was
>>>>>> pushed
>>>>>>
>>>>>> So please do not encourage people to push directly.
>>>>>>
>>>>>>
>>>>>>> On 15/05/15 20:07, Saverio Proto wrote: Hello Daniel,
>>>>>>>
>>>>>>> I think you can push this patch to olsrd master branch in
>>>>>>> git. the git repository is open for commit without
>>>>>>> authentication.
>>>>>>>
>>>>>>> thank you
>>>>>>>
>>>>>>> Saverio
>>>>>>>
>>>>>>>
>>>>>>> 2015-05-15 19:13 GMT+02:00 Daniel Golle
>>>>>>> <(spam-protected)>:
>>>>>>>> Introduce checks for __UCLIBC__ to compensate for
>>>>>>>> incompatible definitions of struct udphdr present in
>>>>>>>> different libc. glibc provides both field nameing
>>>>>>>> styles, afaik all libcs except for uClibc provide the
>>>>>>>> POSIX definition.
>>>>>>>>
>>>>>>>> Signed-off-by: Daniel Golle <(spam-protected)>
>>>>>>>> --- See also
>>>>>>>> https://github.com/openwrt-routing/packages/pull/85
>>>>>>>>
>>>>>>>> lib/bmf/src/Address.c           |  4 ++++
>>>>>>>> lib/bmf/src/Bmf.c               |  4 ++++
>>>>>>>> lib/bmf/src/NetworkInterfaces.c |  9 +++++++++
>>>>>>>> lib/mdns/src/mdns.c             |  8 ++++++++
>>>>>>>> lib/p2pd/src/p2pd.c             | 16 ++++++++++++++++ 5
>>>>>>>> files changed, 41 insertions(+)
>>>>>>>>
>>>>>>>> diff --git a/lib/bmf/src/Address.c
>>>>>>>> b/lib/bmf/src/Address.c index 67e7499..9d244da 100644
>>>>>>>> --- a/lib/bmf/src/Address.c +++
>>>>>>>> b/lib/bmf/src/Address.c @@ -142,7 +142,11 @@ int
>>>>>>>> IsOlsrOrBmfPacket(unsigned char* ipPacket)
>>>>>>>>
>>>>>>>> /* Go into the UDP header and check port number */
>>>>>>>> udpHeader = (struct udphdr*) ARM_NOWARN_ALIGN((ipPacket
>>>>>>>> + ipHeaderLen)); +#ifdef __UCLIBC__ destPort =
>>>>>>>> ntohs(udpHeader->dest); +#else +  destPort =
>>>>>>>> ntohs(udpHeader->uh_dport); +#endif
>>>>>>>>
>>>>>>>> if (destPort == olsr_cnf->olsrport || destPort ==
>>>>>>>> BMF_ENCAP_PORT || destPort == 51698) /* TODO: #define
>>>>>>>> for 51698 */ diff --git a/lib/bmf/src/Bmf.c
>>>>>>>> b/lib/bmf/src/Bmf.c index 9bbce42..3730557 100644 ---
>>>>>>>> a/lib/bmf/src/Bmf.c +++ b/lib/bmf/src/Bmf.c @@ -1028,7
>>>>>>>> +1028,11 @@ BMF_handle_listeningFd(int skfd, void
>>>>>>>> *data, unsigned int flags __attribute__ (( }
>>>>>>>>
>>>>>>>> udpHeader = (struct udphdr*) ARM_NOWARN_ALIGN((rxBuffer
>>>>>>>> + headerLength)); +#ifdef __UCLIBC__ destPort =
>>>>>>>> ntohs(udpHeader->dest); +#else +  destPort =
>>>>>>>> ntohs(udpHeader->uh_dport); +#endif if (destPort !=
>>>>>>>> BMF_ENCAP_PORT) { /* Not BMF */ diff --git
>>>>>>>> a/lib/bmf/src/NetworkInterfaces.c
>>>>>>>> b/lib/bmf/src/NetworkInterfaces.c index
>>>>>>>> 49a35a5..a1bc817 100644 ---
>>>>>>>> a/lib/bmf/src/NetworkInterfaces.c +++
>>>>>>>> b/lib/bmf/src/NetworkInterfaces.c @@ -50,6 +50,7 @@
>>>>>>>> #include <assert.h> /* assert() */ #include <net/if.h>
>>>>>>>> /* socket(), ifreq, if_indextoname(), if_nametoindex()
>>>>>>>> */ #include <netinet/in.h> /* htons() */ +#include
>>>>>>>> <netinet/udp.h> /* struct udphdr */ #include
>>>>>>>> <linux/if_ether.h> /* ETH_P_IP */ #include
>>>>>>>> <linux/if_packet.h> /* packet_mreq, PACKET_MR_PROMISC,
>>>>>>>> PACKET_ADD_MEMBERSHIP */ #include <linux/if_tun.h> /*
>>>>>>>> IFF_TAP */ @@ -1893,7 +1894,11 @@ void
>>>>>>>> CheckAndUpdateLocalBroadcast(unsigned char* ipPacket,
>>>>>>>> union olsr_ip_addr* b
>>>>>>>>
>>>>>>>> /* RFC 1624, Eq. 3: HC' = ~(~HC - m + m') */
>>>>>>>>
>>>>>>>> +#ifdef __UCLIBC__ check = ntohs(udph->check); +#else +
>>>>>>>> check = ntohs(udph->uh_sum); +#endif
>>>>>>>>
>>>>>>>> check = ~ (~ check - ((origDaddr >> 16) & 0xFFFF) +
>>>>>>>> ((newDaddr >> 16) & 0xFFFF)); check = ~ (~ check -
>>>>>>>> (origDaddr & 0xFFFF) + (newDaddr & 0xFFFF)); @@ -1901,7
>>>>>>>> +1906,11 @@ void CheckAndUpdateLocalBroadcast(unsigned
>>>>>>>> char* ipPacket, union olsr_ip_addr* b /* Add carry */
>>>>>>>> check = check + (check >> 16);
>>>>>>>>
>>>>>>>> +#ifdef __UCLIBC__ udph->check = htons(check); +#else +
>>>>>>>> udph->uh_sum = htons(check); +#endif } /* if */ } /* if
>>>>>>>> */ } /* CheckAndUpdateLocalBroadcast */ diff --git
>>>>>>>> a/lib/mdns/src/mdns.c b/lib/mdns/src/mdns.c index
>>>>>>>> 8fc20f7..f8ed460 100644 --- a/lib/mdns/src/mdns.c +++
>>>>>>>> b/lib/mdns/src/mdns.c @@ -462,7 +462,11 @@
>>>>>>>> BmfPacketCaptured( return;                   /* for */
>>>>>>>> } udpHeader = (struct udphdr
>>>>>>>> *)ARM_NOWARN_ALIGN(encapsulationUdpData +
>>>>>>>> GetIpHeaderLength(encapsulationUdpData)); +#ifdef
>>>>>>>> __UCLIBC__ destPort = ntohs(udpHeader->dest); +#else +
>>>>>>>> destPort = ntohs(udpHeader->uh_dport); +#endif if
>>>>>>>> (destPort != 5353) { return; } @@ -498,7 +502,11 @@
>>>>>>>> BmfPacketCaptured( return;                   /* for */
>>>>>>>> } udpHeader = (struct udphdr
>>>>>>>> *)ARM_NOWARN_ALIGN(encapsulationUdpData + 40); +#ifdef
>>>>>>>> __UCLIBC__ destPort = ntohs(udpHeader->dest); +#else +
>>>>>>>> destPort = ntohs(udpHeader->uh_dport); +#endif if
>>>>>>>> (destPort != 5353) { return; } diff --git
>>>>>>>> a/lib/p2pd/src/p2pd.c b/lib/p2pd/src/p2pd.c index
>>>>>>>> 60c4f74..77d2dff 100644 --- a/lib/p2pd/src/p2pd.c +++
>>>>>>>> b/lib/p2pd/src/p2pd.c @@ -204,7 +204,11 @@
>>>>>>>> PacketReceivedFromOLSR(unsigned char
>>>>>>>> *encapsulationUdpData, int len) udpHeader = (struct
>>>>>>>> udphdr*) ARM_NOWARN_ALIGN((encapsulationUdpData +
>>>>>>>>
>>>>>>>> GetIpHeaderLength(encapsulationUdpData)));
>>>>>>>> destAddr.v4.s_addr = ipHeader->ip_dst.s_addr; +#ifdef
>>>>>>>> __UCLIBC__ destPort = htons(udpHeader->dest); +#else +
>>>>>>>> destPort = htons(udpHeader->uh_dport); +#endif isInList
>>>>>>>> = InUdpDestPortList(AF_INET, &destAddr, destPort);
>>>>>>>> #ifdef INCLUDE_DEBUG_OUTPUT if (!isInList) { @@ -223,7
>>>>>>>> +227,11 @@ PacketReceivedFromOLSR(unsigned char
>>>>>>>> *encapsulationUdpData, int len) if (ip6Header->ip6_nxt
>>>>>>>> == SOL_UDP && !IsIpv6Fragment(ip6Header)) { udpHeader =
>>>>>>>> (struct udphdr*) ARM_NOWARN_ALIGN((encapsulationUdpData
>>>>>>>> + 40)); memcpy(&destAddr.v6, &ip6Header->ip6_dst,
>>>>>>>> sizeof(struct in6_addr)); +#ifdef __UCLIBC__ destPort =
>>>>>>>> htons(udpHeader->dest); +#else +          destPort =
>>>>>>>> htons(udpHeader->uh_dport); +#endif isInList =
>>>>>>>> InUdpDestPortList(AF_INET6, &destAddr, destPort);
>>>>>>>> #ifdef INCLUDE_DEBUG_OUTPUT if (!isInList) { @@ -695,7
>>>>>>>> +703,11 @@ P2pdPacketCaptured(unsigned char
>>>>>>>> *encapsulationUdpData, int nBytes)
>>>>>>>>
>>>>>>>> udpHeader = (struct udphdr *)
>>>>>>>> ARM_NOWARN_ALIGN((encapsulationUdpData +
>>>>>>>>
>>>>>>>> GetIpHeaderLength(encapsulationUdpData))); +#ifdef
>>>>>>>> __UCLIBC__ destPort = ntohs(udpHeader->dest); +#else +
>>>>>>>> destPort = ntohs(udpHeader->uh_dport); +#endif
>>>>>>>>
>>>>>>>> if (!InUdpDestPortList(AF_INET, &dst, destPort)) {
>>>>>>>> #ifdef INCLUDE_DEBUG_OUTPUT @@ -739,7 +751,11 @@
>>>>>>>> P2pdPacketCaptured(unsigned char *encapsulationUdpData,
>>>>>>>> int nBytes) return;
>>>>>>>>
>>>>>>>> udpHeader = (struct udphdr *)
>>>>>>>> ARM_NOWARN_ALIGN((encapsulationUdpData + 40)); +#ifdef
>>>>>>>> __UCLIBC__ destPort = ntohs(udpHeader->dest); +#else +
>>>>>>>> destPort = ntohs(udpHeader->uh_dport); +#endif
>>>>>>>>
>>>>>>>> if (!InUdpDestPortList(AF_INET6, &dst, destPort)) {
>>>>>>>> #ifdef INCLUDE_DEBUG_OUTPUT -- 2.4.0
>>>>>>>>
>>>>>>>>
>>>>>>>> -- Olsr-dev mailing list (spam-protected)
>>>>>>>> https://lists.olsr.org/mailman/listinfo/olsr-dev
>>>>>>
>>>>>> -- Ferry Huberts
>>
>> -- Ferry Huberts
>>
>> -- Olsr-dev mailing list (spam-protected)
>> https://lists.olsr.org/mailman/listinfo/olsr-dev

-- 
Ferry Huberts




More information about the Olsr-dev mailing list