Skip to content

Commit 5cdd083

Browse files
author
Nils Büchner
committed
add backward compatibility
1 parent 540e930 commit 5cdd083

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/ts3init_target.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ ts3init_send_ipv4_reply(struct sk_buff *oldskb, const struct xt_action_param *pa
184184
dst_init2(&dste, oldskb->dev);
185185
skb_dst_set_noref(skb, &dste);
186186

187-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
187+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 78)
188188
if (unlikely(ip_route_me_harder(par_net(par), skb->sk, skb, RTN_UNSPEC) != 0)){
189189
#else
190-
if (unlikely(ip_route_me_harder(par_net(par), skb, RTN_UNSPEC) != 0)){
190+
if (ip_route_me_harder(par_net(par), skb, RTN_UNSPEC) != 0){
191191
#endif
192192
goto free_nskb;
193193
}
@@ -227,7 +227,11 @@ ts3init_reset_ipv4_tg(struct sk_buff *skb, const struct xt_action_param *par)
227227
return NF_DROP;
228228

229229
ts3init_send_ipv4_reply(skb, par, ip, udp, ts3init_reset_packet, sizeof(ts3init_reset_packet));
230+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0)
230231
nf_reset_ct(skb);
232+
#else
233+
nf_reset(skb);
234+
#endif
231235
consume_skb(skb);
232236
return NF_STOLEN;
233237
}
@@ -247,7 +251,11 @@ ts3init_reset_ipv6_tg(struct sk_buff *skb, const struct xt_action_param *par)
247251
return NF_DROP;
248252

249253
ts3init_send_ipv6_reply(skb, par, ip, udp, ts3init_reset_packet, sizeof(ts3init_reset_packet));
254+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0)
250255
nf_reset_ct(skb);
256+
#else
257+
nf_reset(skb);
258+
#endif
251259
consume_skb(skb);
252260
return NF_STOLEN;
253261
}
@@ -357,7 +365,11 @@ ts3init_set_cookie_ipv4_tg(struct sk_buff *skb, const struct xt_action_param *pa
357365
ts3init_fill_set_cookie_payload(skb, par, cookie, packet_index, payload))
358366
{
359367
ts3init_send_ipv4_reply(skb, par, ip, udp, payload, sizeof(payload));
368+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0)
360369
nf_reset_ct(skb);
370+
#else
371+
nf_reset(skb);
372+
#endif
361373
consume_skb(skb);
362374
return NF_STOLEN;
363375
}
@@ -386,7 +398,11 @@ ts3init_set_cookie_ipv6_tg(struct sk_buff *skb, const struct xt_action_param *pa
386398
ts3init_fill_set_cookie_payload(skb, par, cookie, packet_index, payload))
387399
{
388400
ts3init_send_ipv6_reply(skb, par, ip, udp, payload, sizeof(payload));
401+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0)
389402
nf_reset_ct(skb);
403+
#else
404+
nf_reset(skb);
405+
#endif
390406
consume_skb(skb);
391407
return NF_STOLEN;
392408
}

0 commit comments

Comments
 (0)