diff --git a/doc/changelog.txt b/doc/changelog.txt index 367e8f2..210bb8c 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -3,6 +3,8 @@ HEAD ==== Fixes: - xt_ECHO: fix kernel warning about RTAX_HOPLIMIT being used +Changes: +- xt_ECHO: now calculates UDP checksum v1.39 (2011-09-21) diff --git a/extensions/xt_ECHO.c b/extensions/xt_ECHO.c index 389be12..ff4f13b 100644 --- a/extensions/xt_ECHO.c +++ b/extensions/xt_ECHO.c @@ -70,13 +70,25 @@ echo_tg4(struct sk_buff **poldskb, const struct xt_action_param *par) newudp->source = oldudp->dest; newudp->dest = oldudp->source; newudp->len = oldudp->len; - newudp->check = 0; data_len = htons(oldudp->len) - sizeof(*oldudp); payload = skb_header_pointer(oldskb, par->thoff + sizeof(*oldudp), data_len, NULL); memcpy(skb_put(newskb, data_len), payload, data_len); +#if 0 + /* + * Since no fields are modified (we just swapped things around), + * this works too in our specific echo case. + */ + newudp->check = oldudp->check; +#else + newudp->check = 0; + newudp->check = csum_tcpudp_magic(newip->saddr, newip->daddr, + ntohs(newudp->len), IPPROTO_UDP, + csum_partial(newudp, ntohs(newudp->len), 0)); +#endif + /* ip_route_me_harder expects the skb's dst to be set */ skb_dst_set(newskb, dst_clone(skb_dst(oldskb)));