Browse Source

added udp checksum calculation

pull/1/head
Maximilian Münchow 8 years ago
parent
commit
cc16338fc0
  1. 6
      src/ts3init_target.c

6
src/ts3init_target.c

@ -422,6 +422,9 @@ ts3init_morph_to_get_cookie_ipv4_tg(struct sk_buff *skb, const struct xt_action_ @@ -422,6 +422,9 @@ ts3init_morph_to_get_cookie_ipv4_tg(struct sk_buff *skb, const struct xt_action_
udp->len = htons(sizeof(*udp) + sizeof(payload_buf));
udp->check = 0;
udp->check = csum_tcpudp_magic(ip->saddr, ip->daddr,
ntohs(udp->len), IPPROTO_UDP,
csum_partial(udp, ntohs(udp->len), 0));
ip->tot_len = htons(skb->len);
skb->ip_summed = CHECKSUM_NONE;
@ -457,6 +460,9 @@ ts3init_morph_to_get_cookie_ipv6_tg(struct sk_buff *skb, const struct xt_action_ @@ -457,6 +460,9 @@ ts3init_morph_to_get_cookie_ipv6_tg(struct sk_buff *skb, const struct xt_action_
udp->len = htons(sizeof(*udp) + sizeof(payload_buf));
udp->check = 0;
udp->check = csum_ipv6_magic(&ip->saddr, &ip->daddr,
ntohs(udp->len), IPPROTO_UDP,
csum_partial(udp, ntohs(udp->len), 0));
ip->payload_len = htons(skb->len);
skb->ip_summed = CHECKSUM_NONE;

Loading…
Cancel
Save