Author: ae
Date: Sun Mar 10 04:41:30 2019
New Revision: 344976
URL: https://svnweb.freebsd.org/changeset/base/344976

Log:
  MFC r344870:
    Fix the problem with O_LIMIT states introduced in r344018.
  
    dyn_install_state() uses `rule` pointer when it creates state.
    For O_LIMIT states this pointer actually is not struct ip_fw,
    it is pointer to O_LIMIT_PARENT state, that keeps actual pointer
    to ip_fw parent rule. Thus we need to cache rule id and number
    before calling dyn_get_parent_state(), so we can use them later
    when the `rule` pointer is overrided.
  
    PR:         236292

Modified:
  stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c
==============================================================================
--- stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c  Sun Mar 10 00:56:39 2019        
(r344975)
+++ stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c  Sun Mar 10 04:41:30 2019        
(r344976)
@@ -1869,11 +1869,13 @@ dyn_install_state(const struct ipfw_flow_id *pkt, uint
     uint16_t kidx, uint8_t type)
 {
        struct ipfw_flow_id id;
-       uint32_t hashval, parent_hashval;
+       uint32_t hashval, parent_hashval, ruleid, rulenum;
        int ret;
 
        MPASS(type == O_LIMIT || type == O_KEEP_STATE);
 
+       ruleid = rule->id;
+       rulenum = rule->rulenum;
        if (type == O_LIMIT) {
                /* Create masked flow id and calculate bucket */
                id.addr_type = pkt->addr_type;
@@ -1928,11 +1930,11 @@ dyn_install_state(const struct ipfw_flow_id *pkt, uint
 
        hashval = hash_packet(pkt);
        if (IS_IP4_FLOW_ID(pkt))
-               ret = dyn_add_ipv4_state(rule, rule->id, rule->rulenum, pkt,
+               ret = dyn_add_ipv4_state(rule, ruleid, rulenum, pkt,
                    ulp, pktlen, hashval, info, fibnum, kidx, type);
 #ifdef INET6
        else if (IS_IP6_FLOW_ID(pkt))
-               ret = dyn_add_ipv6_state(rule, rule->id, rule->rulenum, pkt,
+               ret = dyn_add_ipv6_state(rule, ruleid, rulenum, pkt,
                    zoneid, ulp, pktlen, hashval, info, fibnum, kidx, type);
 #endif /* INET6 */
        else
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to