Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2021
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.20 KB | None | 0 0
  1. iff --git a/rules.c b/rules.c
  2. index 181c6b1..969c385 100644
  3. --- a/rules.c
  4. +++ b/rules.c
  5. @@ -420,6 +420,7 @@ print_rule(struct fw3_ipt_handle *handle, struct fw3_state *state,
  6.             struct fw3_mac *mac, struct fw3_icmptype *icmptype)
  7.  {
  8.         struct fw3_ipt_rule *r;
  9. +       struct fw3_device *idev, *odev;
  10.  
  11.         if (!fw3_is_family(sip, handle->family) ||
  12.             !fw3_is_family(dip, handle->family))
  13. @@ -471,6 +472,36 @@ print_rule(struct fw3_ipt_handle *handle, struct fw3_state *state,
  14.                 return;
  15.         }
  16.  
  17. +       if (rule->target == FW3_FLAG_DSCP || rule->target == FW3_FLAG_MARK) {
  18. +               fw3_foreach(idev, &rule->_src->devices)
  19. +               fw3_foreach(odev, &rule->_dest->devices)
  20. +               {
  21. +                       r = fw3_ipt_rule_create(handle, proto, idev, odev, sip, dip);
  22. +                       fw3_ipt_rule_sport_dport(r, sport, dport);
  23. +                       fw3_ipt_rule_device(r, rule->device, rule->direction_out);
  24. +                       fw3_ipt_rule_icmptype(r, icmptype);
  25. +                       fw3_ipt_rule_mac(r, mac);
  26. +                       fw3_ipt_rule_ipset(r, &rule->ipset);
  27. +                       fw3_ipt_rule_helper(r, &rule->helper);
  28. +                       fw3_ipt_rule_limit(r, &rule->limit);
  29. +                       fw3_ipt_rule_time(r, &rule->time);
  30. +                       fw3_ipt_rule_mark(r, &rule->mark);
  31. +                       fw3_ipt_rule_dscp(r, &rule->dscp);
  32. +                       set_target(r, rule);
  33. +                       fw3_ipt_rule_extra(r, rule->extra);
  34. +                       set_comment(r, rule->name, num);
  35. +
  36. +                       if (idev && odev)
  37. +                               fw3_ipt_rule_append(r, "FORWARD");
  38. +                       else if (odev)
  39. +                               fw3_ipt_rule_append(r, "POSTROUTING");
  40. +                       else /* if (idev) */
  41. +                               fw3_ipt_rule_append(r, "PREROUTING");
  42. +               }
  43. +
  44. +               return;
  45. +       }
  46. +
  47.         r = fw3_ipt_rule_create(handle, proto, NULL, NULL, sip, dip);
  48.         fw3_ipt_rule_sport_dport(r, sport, dport);
  49.         fw3_ipt_rule_device(r, rule->device, rule->direction_out);
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement