Skip to content
  • Alessandro Rubini's avatar
    vlan: add "vlan off" command, switch pfilter rule-set at runtime · d4c72f47
    Alessandro Rubini authored
    This allows a node built with CONFIG_VLAN to choose at run-time
    whether vlans are allowed or not.  We build both pfilter rule-sets,
    and according to the active vlan number we write one or the other.
    
    The case "CONFIG_VLAN is not set" is handled by providing default
    NULL pointers for beginning and end of the vlan rule-set.
    
    As a side effect, I renamed the files and the functions in
    the pfilter-builder.
    
    This is how it works for me, with CONFIG_PFILTER_VERBOSE set,
    so you see different rule-set  are used (29 rules vs. 16 rules):
    
        wrc# vlan set 0
        0 ("0") out of range
        Command "vlan": error -22
        wrc# vlan off
        fixing MAC adress in rule: use 22:33:44:55:66:77
        pfilter rule 00: 4.00000000
        pfilter rule 01: 1.e4466013
        [...]
        pfilter rule 28: 8.00000000
        current vlan: 0 (0x0)
        wrc# ip set 10.0.0.2
        IP-address: 10.0.0.2 (static assignment)
    
      (and I am now reachable by untagged frames)
    
        wrc# vlan set 10
        ...
    d4c72f47