[Click] wrong assert in udpipencap?

Eddie Kohler ekohler at gmail.com
Wed Aug 8 08:57:23 EDT 2012


Hi Jörg,

No, the assert is correct. "ip" is set from "p->data()". Is the assert failing 
for you? You need to generate a correctly aligned input packet. Try click-align?

Eddie


On 8/8/12 5:08 AM, Jörg Kaiser wrote:
> Hi,
>
> we were cross compiling and stumbled over an assert which seems to be in
> wrong position:
> udpipencap.cc (line 86 et sqq.) assert can never hold true as headers
> are set afterwards.
>
> cheers,
> Jörg
>
>
> Packet *
> UDPIPEncap::simple_action(Packet *p_in)
> {
>     WritablePacket *p = p_in->push(sizeof(click_udp) + sizeof(click_ip));
>     click_ip *ip = reinterpret_cast<click_ip *>(p->data());
>     click_udp *udp = reinterpret_cast<click_udp *>(ip + 1);
>
> #if !HAVE_INDIFFERENT_ALIGNMENT
>     assert((uintptr_t)ip % 4 == 0);
> #endif
>     // set up IP header
>     ip->ip_v = 4;
>     ip->ip_hl = sizeof(click_ip) >> 2;
>     ip->ip_len = htons(p->length());
>     ip->ip_id = htons(_id.fetch_and_add(1));
>     ip->ip_p = IP_PROTO_UDP;
>     ip->ip_src = _saddr;
>
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>


More information about the click mailing list