|
23 | 23 | #include <net/netfilter/nf_conntrack.h> |
24 | 24 | #include <net/netfilter/nf_conntrack_l4proto.h> |
25 | 25 | #include <net/netfilter/nf_conntrack_ecache.h> |
| 26 | +#include <net/netfilter/nf_conntrack_timeout.h> |
26 | 27 | #include <net/netfilter/nf_log.h> |
27 | 28 |
|
28 | 29 | /* Timeouts are based on values from RFC4340: |
@@ -389,7 +390,7 @@ static inline struct nf_dccp_net *dccp_pernet(struct net *net) |
389 | 390 | } |
390 | 391 |
|
391 | 392 | static bool dccp_new(struct nf_conn *ct, const struct sk_buff *skb, |
392 | | - unsigned int dataoff, unsigned int *timeouts) |
| 393 | + unsigned int dataoff) |
393 | 394 | { |
394 | 395 | struct net *net = nf_ct_net(ct); |
395 | 396 | struct nf_dccp_net *dn; |
@@ -437,19 +438,14 @@ static u64 dccp_ack_seq(const struct dccp_hdr *dh) |
437 | 438 | ntohl(dhack->dccph_ack_nr_low); |
438 | 439 | } |
439 | 440 |
|
440 | | -static unsigned int *dccp_get_timeouts(struct net *net) |
441 | | -{ |
442 | | - return dccp_pernet(net)->dccp_timeout; |
443 | | -} |
444 | | - |
445 | 441 | static int dccp_packet(struct nf_conn *ct, const struct sk_buff *skb, |
446 | | - unsigned int dataoff, enum ip_conntrack_info ctinfo, |
447 | | - unsigned int *timeouts) |
| 442 | + unsigned int dataoff, enum ip_conntrack_info ctinfo) |
448 | 443 | { |
449 | 444 | enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); |
450 | 445 | struct dccp_hdr _dh, *dh; |
451 | 446 | u_int8_t type, old_state, new_state; |
452 | 447 | enum ct_dccp_roles role; |
| 448 | + unsigned int *timeouts; |
453 | 449 |
|
454 | 450 | dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &_dh); |
455 | 451 | BUG_ON(dh == NULL); |
@@ -523,6 +519,9 @@ static int dccp_packet(struct nf_conn *ct, const struct sk_buff *skb, |
523 | 519 | if (new_state != old_state) |
524 | 520 | nf_conntrack_event_cache(IPCT_PROTOINFO, ct); |
525 | 521 |
|
| 522 | + timeouts = nf_ct_timeout_lookup(ct); |
| 523 | + if (!timeouts) |
| 524 | + timeouts = dccp_pernet(nf_ct_net(ct))->dccp_timeout; |
526 | 525 | nf_ct_refresh_acct(ct, ctinfo, skb, timeouts[new_state]); |
527 | 526 |
|
528 | 527 | return NF_ACCEPT; |
@@ -843,7 +842,6 @@ const struct nf_conntrack_l4proto nf_conntrack_l4proto_dccp4 = { |
843 | 842 | .l4proto = IPPROTO_DCCP, |
844 | 843 | .new = dccp_new, |
845 | 844 | .packet = dccp_packet, |
846 | | - .get_timeouts = dccp_get_timeouts, |
847 | 845 | .error = dccp_error, |
848 | 846 | .can_early_drop = dccp_can_early_drop, |
849 | 847 | #ifdef CONFIG_NF_CONNTRACK_PROCFS |
@@ -877,7 +875,6 @@ const struct nf_conntrack_l4proto nf_conntrack_l4proto_dccp6 = { |
877 | 875 | .l4proto = IPPROTO_DCCP, |
878 | 876 | .new = dccp_new, |
879 | 877 | .packet = dccp_packet, |
880 | | - .get_timeouts = dccp_get_timeouts, |
881 | 878 | .error = dccp_error, |
882 | 879 | .can_early_drop = dccp_can_early_drop, |
883 | 880 | #ifdef CONFIG_NF_CONNTRACK_PROCFS |
|
0 commit comments