Home | History | Annotate | Line # | Download | only in doc
TODO.npf revision 1.11
      1  1.11       gdt # $NetBSD: TODO.npf,v 1.11 2025/04/17 18:11:58 gdt Exp $
      2   1.1      maxv 
      3  1.10       gdt # Meta
      4   1.9       gdt 
      5  1.11       gdt This file intends to be the location for all work needing to be done
      6  1.11       gdt for npf within NetBSD, except for bugs that are straightforward enough to live
      7  1.11       gdt in gnats.
      8   1.1      maxv 
      9  1.11       gdt (The older TODO list, last modified in May, 2020:
     10  1.10       gdt   https://www.netbsd.org/~rmind/npf/__tasklist.html
     11  1.11       gdt has been merged into this file.)
     12   1.9       gdt 
     13  1.10       gdt ## Review all items to see if they are still relevant and correct.
     14   1.1      maxv 
     15  1.10       gdt # Documentation
     16   1.1      maxv 
     17  1.10       gdt ## how to convert other packet filters to npf
     18   1.1      maxv 
     19  1.10       gdt ## add more examples
     20   1.1      maxv 
     21  1.10       gdt # npfctl
     22   1.1      maxv 
     23  1.10       gdt ## npfctl start does not load
     24   1.1      maxv 
     25  1.10       gdt npfctl start does not load the configuration if not loaded.
     26  1.10       gdt It is not clear you need to reload first. Or if it loads it should
     27  1.10       gdt print the error messages. Or it should be called enable/disable since
     28  1.10       gdt this is what it does. It does not "start" because like an engine with
     29  1.10       gdt no fuel, an npf with no configuration does not do much.
     30   1.1      maxv 
     31  1.10       gdt ## better error reporting
     32   1.1      maxv 
     33  1.10       gdt although the framework checks the file for consistency, returning
     34  1.10       gdt EINVAL for system failures is probably not good enough. For example if
     35  1.10       gdt a module failed to autoload, it is probably an error and it should be
     36  1.10       gdt reported differently?
     37   1.1      maxv 
     38  1.10       gdt ## startup/stop script does not load and save session state
     39   1.1      maxv 
     40  1.11       gdt ## add support for "with short"
     41   1.1      maxv 
     42  1.10       gdt ## implement "port-unr"
     43   1.1      maxv 
     44  1.10       gdt ## implement block return-icmp in log final all with ipopts
     45   1.1      maxv 
     46  1.10       gdt ## handle array variables in more places
     47   1.1      maxv 
     48  1.11       gdt ## support variables and inline sets which contain both IPv4 and IPv6 addresses
     49  1.11       gdt 
     50  1.11       gdt for example: $ext_if = { inet4(wm0), inet6(wm0) }
     51  1.11       gdt 
     52  1.11       gdt ## support inline blocks with different types of data in the rule.
     53  1.11       gdt 
     54  1.11       gdt This will require a clean-up of the type system in
     55  1.11       gdt npfctl parser, since it is currently a bit of a mess. Examples:
     56  1.11       gdt 
     57  1.11       gdt 	pass in from all to { inet4(wm0), $some_var, 10.0.0.1,  }
     58  1.11       gdt 	pass in final proto tcp to 172.28.1.2 port { 161, 162 }
     59  1.11       gdt 	pass in final proto { tcp, udp } to 172.28.1.2 port 53
     60  1.11       gdt 
     61  1.11       gdt [MOSTLY DONE?]
     62  1.11       gdt 
     63  1.11       gdt ## npf show improvements
     64  1.11       gdt 
     65  1.11       gdt Consistent `npfctl show' output with rule syntax.  Difficult/messy
     66  1.11       gdt because rules are compiled into the byte-code.
     67  1.11       gdt 
     68  1.11       gdt # Architectural changes
     69  1.11       gdt 
     70  1.11       gdt ## Layer 2 filtering
     71  1.11       gdt 
     72  1.11       gdt 1. All rules in NPF are added to a ruleset.  At this moment, it is assumed
     73  1.11       gdt    that there is only one ruleset and all rules are processed at layer 3.
     74  1.11       gdt    One approach is to support another ruleset for layer 2 (or rather, have
     75  1.11       gdt    capability to specify the "starting layer").
     76  1.11       gdt 
     77  1.11       gdt 2. One way to separate L2 and L3 rules could be by marking groups.  In NPF,
     78  1.11       gdt    a group is just a rule (i.e. rules can be nested).
     79  1.11       gdt 
     80  1.11       gdt 3. npfctl: update the parser such that the group would have an option for
     81  1.11       gdt    specifying a layer.  See "group_opts" token in npf_parse.y file.  Also,
     82  1.11       gdt    we may want to add support for "hwaddr <mac>" syntax or something.
     83  1.11       gdt 
     84  1.11       gdt 4. npfctl_build_rule() code will need to distinguish groups/rules which
     85  1.11       gdt    were marked as layer 2, i.e. byte-code generation (npfctl_build_code()
     86  1.11       gdt    and the logic in it) needs to know that we are starting from Ethernet
     87  1.11       gdt    header and not IP header.  Note: it needs to be passed to all nested
     88  1.11       gdt    rules, so basically take the option from the "current group".
     89  1.11       gdt 
     90  1.11       gdt 5. For a start (i.e. less work to do), you can just add byte-code to parse
     91  1.11       gdt    Ethernet header and compare the MAC addresses.  Just return "not supported"
     92  1.11       gdt    error for any other filter pattern.
     93  1.11       gdt 
     94  1.11       gdt 6. libnpf: create a new ruleset for L2 and add all groups (and its nested
     95  1.11       gdt    rules) there.  To keep it simpler, we can add npf_rule_setlayer() function
     96  1.11       gdt    and just handle this separation in libnpf rather than npfctl.
     97  1.11       gdt 
     98  1.11       gdt 7. libnpf-kernel: currently, proplib dictionary has only one "ruleset" dict.
     99  1.11       gdt    This needs to be split into "ruleset-l3" and "ruleset-l2".  Retrieve and
    100  1.11       gdt    construct a new ruleset in npfctl_reload(); it is simple, but disgusting
    101  1.11       gdt    proplib code.  It is just re-using the existing code to handle another
    102  1.11       gdt    ruleset.
    103  1.11       gdt 
    104  1.11       gdt 8. Kernel: add a new handler in npf_handler.c, e.g. npf_packet_l2handler()
    105  1.11       gdt    or something.  Register it in npf_pfil_register() using Ethernet pfil
    106  1.11       gdt    hook.  In the handler, call npf_ruleset_inspect() passing L2 ruleset.
    107  1.11       gdt 
    108  1.11       gdt ## Consider single large BPF program
    109  1.11       gdt 
    110  1.11       gdt Implement NPF rules as a single large BPF program, instead of
    111  1.11       gdt providing BPF byte-code per each rule. In combination with BPF JIT
    112  1.11       gdt compilation, such approach would significantly improve the performance
    113  1.11       gdt of very large rulesets. Problems: BPF byte-code limitations; we can
    114  1.11       gdt either extend the byte-code or workaround them.
    115  1.11       gdt 
    116  1.11       gdt ## Multiple rule matching
    117  1.11       gdt 
    118  1.11       gdt Multiple rule matching to call the rule-procedures or a suitable
    119  1.11       gdt design alternative to that.
    120  1.11       gdt 
    121  1.11       gdt ## ipchains-like feature
    122  1.11       gdt 
    123  1.11       gdt Implement ipchains-like feature to support nested rules and sharing of
    124  1.11       gdt a rule group. NPF already supports nested rules. Unresolved questions
    125  1.11       gdt are: 1) what kind of complexity of rule chains do we want to support,
    126  1.11       gdt e.g. a directed graph with loop resolution or more strict hierarchy
    127  1.11       gdt which does not allow jumping up the chain? 2) syntax in npf.conf file.
    128  1.11       gdt 
    129  1.11       gdt ## redundancy and load balancing
    130  1.11       gdt 
    131  1.11       gdt Redundancy and load balancing: initially, add state replication and
    132  1.11       gdt replace in-kernel CARP/VRRP with a userlevel daemon. Note: we probably
    133  1.11       gdt want to eliminate proplib in NPF before doing this.
    134  1.11       gdt 
    135  1.11       gdt ##  QoS
    136  1.11       gdt 
    137  1.11       gdt QoS: rate limiting, traffic shaping, prioritising. Question: how much
    138  1.11       gdt of this should be a part of the packet filter and how much of the
    139  1.11       gdt network stack (merely involving some integration with the packet
    140  1.11       gdt filters)?
    141  1.11       gdt 
    142  1.11       gdt ## tuples in tables
    143  1.11       gdt 
    144  1.11       gdt Support for tuples in tables: address and port, as well as just port. 
    145  1.11       gdt 
    146  1.11       gdt # Features (not needing architectural changes)
    147  1.11       gdt 
    148  1.11       gdt ## Add an extension to support source routing / re-routing of packets.
    149  1.11       gdt 
    150  1.11       gdt See: http://mail-index.netbsd.org/tech-net/2014/05/19/msg004526.html 
    151  1.11       gdt 
    152  1.11       gdt ## support for ALTQ
    153  1.11       gdt 
    154  1.11       gdt Integration with ALTQ as an intermediate solution. In the long term,
    155  1.11       gdt we should implement a better QoS mechanism as part of NPF. Meanwhile,
    156  1.11       gdt NPF can integrate with ALTQ quite easily using the mbuf tags.
    157  1.11       gdt 
    158  1.11       gdt ## Support for NAT64 i.e. the protocol translation. 
    159  1.11       gdt 
    160  1.11       gdt ## Implement ftp-proxy forward proxy support
    161  1.11       gdt 
    162  1.11       gdt (for active FTP client behind NAT).
    163  1.11       gdt     
    164  1.11       gdt ## Patch Squid proxy to support transparent-proxy with NPF.
    165  1.11       gdt 
    166  1.11       gdt Just an ioctl call to perform a state lookup?
    167  1.11       gdt 
    168  1.11       gdt ## MiniUPnP
    169  1.11       gdt 
    170  1.11       gdt Add support for MiniUPnP (see http://miniupnp.free.fr/ web page). 
    171  1.11       gdt 
    172  1.11       gdt # Security
    173  1.11       gdt 
    174  1.11       gdt ## Extra measures to prevent from SYN flood attacks.
    175  1.11       gdt 
    176  1.11       gdt E.g. accelerate connection expiration on low memory or after certain
    177  1.11       gdt threshold. The timeout can also be self-balancing.
    178  1.11       gdt 
    179  1.11       gdt ## Consider blind reset attack using SYN (see RFC 5961).
    180  1.11       gdt 
    181  1.11       gdt ## Consider experimentation to use bloom filters against certain DoS attacks.
    182  1.11       gdt 
    183  1.10       gdt # General
    184   1.1      maxv 
    185  1.10       gdt ## disable IPv4 options by default
    186   1.2      maxv 
    187  1.10       gdt and add a "allow-ip4opts" feature to enable them
    188  1.10       gdt 
    189  1.10       gdt ## disable IPv6 options
    190  1.10       gdt 
    191  1.10       gdt (IPPROTO_ROUTING, IPPROTO_HOPOPTS and IPPROTO_DSTOPTS) by default, and
    192  1.10       gdt add a "allow-ip6opts" feature to enable them
    193  1.10       gdt 
    194  1.10       gdt ## add an ioctl, similar to PF's DIOCNATLOOK and IPF's SIOCGNATL
    195  1.10       gdt 
    196  1.10       gdt document it so that it can be added in third-party software, like:
    197  1.10       gdt    https://github.com/squid-cache/squid/blob/5b74111aff8948e869959113241adada0cd488c2/src/ip/Intercept.cc#L263
    198  1.10       gdt 
    199  1.10       gdt ## support IPv6 jumbograms
    200  1.10       gdt 
    201  1.10       gdt ## support large IPv6 options
    202  1.10       gdt 
    203  1.10       gdt as explained here:
    204   1.2      maxv        http://mail-index.netbsd.org/tech-net/2018/04/08/msg006786.html
    205  1.10       gdt But it's not a big problem - perhaps we don't care at all.
    206  1.10       gdt 
    207  1.10       gdt ## add command line variables.  See -D option in pf.
    208   1.4     darcy 
    209  1.10       gdt ## improve mss clamping
    210   1.5  sborrill 
    211  1.10       gdt as explained here:
    212   1.5  sborrill        http://mail-index.netbsd.org/tech-net/2017/01/15/msg006224.html
    213  1.11       gdt 
    214  1.11       gdt ## IPv6 reassembly
    215  1.11       gdt 
    216  1.11       gdt Investigate and fix the IPv6 reassembly (there is a memory leak).
    217  1.11       gdt 
    218  1.11       gdt ## nbuf_ensure_writable
    219  1.11       gdt 
    220  1.11       gdt Use nbuf_ensure_writable() where appropriate.
    221  1.11       gdt 
    222  1.11       gdt ## TCP FSM enhancement
    223  1.11       gdt 
    224  1.11       gdt Minor TCP FSM investigation: should it be not allowed to immediately re-open the connection after RST or FIN?
    225