Re: Bridge rules

2012-06-30 Thread Henning Brauer
* sven falempin sven.falem...@gmail.com [2012-06-30 02:06]: - ea = ether_aton(argv[0]); + m_size = strnlen(argv[0], ETHER_ADDR_LEN+1 ); + if ( m_size ETHER_ADDR_LEN || m_size 3 ) { + warnx(mac

Re: Bridge rules

2012-06-30 Thread Stuart Henderson
On 2012/06/29 20:05, sven falempin wrote: ifconfig bridge0 rule pass in on fxp0 src de:ff:* wouldn't it be simpler to just allow a mask value to be set, then you don't need to mess with extra flag variables, just mask the MAC address with this value before comparison. ifconfig bridge0 rule

Re: Bridge rules

2012-06-30 Thread sven falempin
Stuart, The flag is there to not change old behavior. Of course matching the beggining of mac make sense the rest is just strange behavior. But a mac address could be spoof, so it may be used. Its just a - and an if else. thx. I do not understand the other complain. especilly when it s

Re: Bridge rules

2012-06-30 Thread Henning Brauer
* sven falempin sven.falem...@gmail.com [2012-06-30 15:49]: I do not understand the other complain. especilly when it s userland code (the string stuff was done inside ifconfig) using string matching for this is the wrong approach to begin with. mac addresses are just numbers, after all. so a

Re: Bridge rules

2012-06-30 Thread Stuart Henderson
On 2012/06/30 09:47, sven falempin wrote: Stuart, The flag is there to not change old behavior. Since masking with all 0's is pointless, you can use that to identify the standard behaviour, checking against 0 is a fast way to determine if the mask should be applied at all (this means a mask

Re: Bridge rules

2012-06-30 Thread sven falempin
should be more likely an expected diff 2012/6/30 Stuart Henderson s...@spacehopper.org On 2012/06/30 09:47, sven falempin wrote: Stuart, The flag is there to not change old behavior. Since masking with all 0's is pointless, you can use that to identify the standard behaviour, checking

Re: Bridge rules

2012-06-30 Thread sven falempin
beyond the missing in bzero in brconfig.c i certainly broke something bridge0: flags=0 groups: bridge priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp vether0 flags=3LEARNING,DISCOVER port 6 ifpriority 0 ifcost 0 re0

Re: Bridge rules

2012-06-29 Thread Henning Brauer
* sven falempin sven.falem...@gmail.com [2012-06-28 23:53]: Doc : ifconfig bridge0 rule pass in on fxp0 src 0:de:ad:be:ef:0 tag USER1 Want to do something like ifconfig bridge0 rule pass in on fxp0 src 0:de:ad:*:*:* tag OPENBSDAWESOME or ifconfig bridge0 rule pass in on fxp0 src

Re: Bridge rules

2012-06-29 Thread Mike Belopuhov
On Fri, Jun 29, 2012 at 1:36 PM, Henning Brauer lists-openbsdt...@bsws.de wrote: now it's very unclear what your actual problem is - the struct is called ifbreq and used in a number of places, most notably of course the ioctls. he's trying to add patterns to the mac address matching code and

Re: Bridge rules

2012-06-29 Thread Henning Brauer
* Mike Belopuhov m...@crypt.org.ru [2012-06-29 13:46]: On Fri, Jun 29, 2012 at 1:36 PM, Henning Brauer lists-openbsdt...@bsws.de wrote: now it's very unclear what your actual problem is - the struct is called ifbreq and used in a number of places, most notably of course the ioctls. he's

Re: Bridge rules

2012-06-29 Thread sven falempin
2012/6/29 Henning Brauer lists-openbsdt...@bsws.de * Mike Belopuhov m...@crypt.org.ru [2012-06-29 13:46]: On Fri, Jun 29, 2012 at 1:36 PM, Henning Brauer lists-openbsdt...@bsws.de wrote: now it's very unclear what your actual problem is - the struct is called ifbreq and used in a

Re: Bridge rules

2012-06-29 Thread sven falempin
Code Rewriting (nothing new) and asking I seriously wonder if 'that' is good in sys/net/if_bridge.c if (flags == 0) goto return_action; Because if i m not wrong it could be rewritten this way (diff)

Re: Bridge rules

2012-06-29 Thread Ted Unangst
On Fri, Jun 29, 2012 at 15:08, sven falempin wrote: Code Rewriting (nothing new) and asking I seriously wonder if 'that' is good in sys/net/if_bridge.c if (flags == 0) goto return_action; Because if i m not wrong it could be rewritten this way (diff) That does look clearer to me.

Re: Bridge rules

2012-06-29 Thread sven falempin
Feel free to commit those code refactoring :) So, I have problem compiling my diff -for re mac bridge taging- for testing. ../../../../net/if_bridge.h:40:19: error: regex.h: No such file or directory but /usr/src/include/regex.h looks quite accessible .. # find /usr/src -type f -name regex.h

Re: Bridge rules

2012-06-29 Thread sven falempin
2012/6/29 Bret Lambert bret.lamb...@gmail.com Holy crap, you're doing this in a way too fucking complicated manner: for (i = 0; i ETHER_ADDR_LEN; i++) if (addr[i] != match[i] match[i] != '*') return (ENOTAMACTCH); Why do people want to cram useless shit where it

Re: Bridge rules

2012-06-29 Thread sven falempin
compilable diff, ( i reboot new kernel and test userland l8r ) ifconfig bridge0 rule pass in on fxp0 src *:de:ff ifconfig bridge0 rule pass in on fxp0 src de:ff:* rantings time ~ Bret aint't no fool when it comes to the kernel do not make a mess ~ did it from