tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: npf.conf: combining port lists and port ranges works but doesn't?



Hi Timo,

Thanks for bringing this to attention.

It is a valid syntax and expected to work.

I trace the Byte code generated with rules that have port ranges and other single 
ports in a single variable

$services = { 21-32, 22 }

group "ext" on $interface {
        pass in to 192.168.120.4 port $services
        #pass stateful all apply "norm"
}

BPF generated

(010) ldh      [x + 2]
(011) jge      #0x15            jt 12   jf 13
(012) jgt      #0x20            jt 13   jf 14
(013) ja       14
(014) ldh      [x + 2]
(015) jeq      #0x16            jt 17   jf 16
(016) ret      #0
(017) ret      #-1
(018) ret      #0


The whole issue is here
(011) jge      #0x15            jt 12   jf 13
(012) jgt      #0x20            jt 13   jf 14
(013) ja       14

after the lower bound of the range is checked, 
the second check of the port number when greater than the upper bound,
should be a “match” when false and hence jf should go to 17 and not continuing 
processing ports. same if the port range is at the end. jumps to “not match”.


submitting a fix soon. (testing it)
Emmanuel







Home | Main Index | Thread Index | Old Index