[Click] ECN

Beyers Cronje bcronje at gmail.com
Wed Aug 8 08:40:31 EDT 2007


See http://www-nrg.ee.lbl.gov/floyd/ecn/checksums.txt

On 8/8/07, JS <njeanseb at gmail.com> wrote:
>
> Hi everyone,
> I am writing a active queue management element and I need to access the
> ECN
> bit, and I think I have found out how in the MarkIPCE element. But there
> are
> a few line that I don't really understand in the MarkIPCE element I think
> they have something to do with the checksum but if someone can explain me
> what is going on here.
> what is the IP_ECN_ECT2? does this code really have something to do with
> the
> checksum?
>
>     const click_ip *iph = p->ip_header();
>     ....
>     WritablePacket *q = p->uniqueify();
>     click_ip *q_iph = q->ip_header();
>
>     if ((q_iph->ip_tos & IP_ECNMASK) == IP_ECN_ECT2) {
>       unsigned sum = (~ntohs(q_iph->ip_sum) & 0xFFFF) + 0x0001;
>       q_iph->ip_sum = ~htons(sum + (sum >> 16));
>     } else {
>       unsigned sum = (~ntohs(q_iph->ip_sum) & 0xFFFF) + 0x0002;
>       q_iph->ip_sum = ~htons(sum + (sum >> 16));
>     }
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>


More information about the click mailing list