<br><tt><font size=2>libvir-list-bounces@redhat.com wrote on 08/13/2010
03:11:25 PM:<br>
<br>
</font></tt>
<br><tt><font size=2>> <br>
> On 08/13/2010 12:38 PM, Stefan Berger wrote:<br>
> >  When sniffing the network traffic, discard class D and
E IP addresses<br>
> > when sniffing traffic. This was a reason why filters were not
correctly<br>
> > rebuilt on VMs on the local 192.* network when libvirt was restarted
and<br>
> > those VMs did not use a DHCP request to get its IP address.<br>
> > <br>
> > Signed-off-by: Stefan Berger <stefanb@us.ibm.com><br>
> > <br>
> > ---<br>
> >  src/nwfilter/nwfilter_learnipaddr.c |    7 +++++--<br>
> >  1 file changed, 5 insertions(+), 2 deletions(-)<br>
> > <br>
> > Index: libvirt-acl/src/nwfilter/nwfilter_learnipaddr.c<br>
> > ===================================================================<br>
> > --- libvirt-acl.orig/src/nwfilter/nwfilter_learnipaddr.c<br>
> > +++ libvirt-acl/src/nwfilter/nwfilter_learnipaddr.c<br>
> > @@ -546,9 +546,12 @@ learnIPAddressThread(void *arg)<br>
> >                  
   struct iphdr *iphdr = (struct iphdr*)(packet +<br>
> >                  
                     
                   ethHdrSize);<br>
> >                  
   vmaddr = iphdr->saddr;<br>
> > -                  
 // skip eth. bcast and mcast addresses,<br>
> > +                  
 // skip eth. bcast and mcast addresses (224.0.0.0 -<br>
> > +                  
 // 239.255.255.255), class E (255.*)<br>
> >                  
   // and zero address in DHCP Requests<br>
> > -                  
 if ((ntohl(vmaddr) & 0xc0000000) || vmaddr == 0) {<br>
> > +                  
 if ( (ntohl(vmaddr) & 0xe0000000) == 0xe0000000 ||<br>
> <br>
> This line's fine for 224-239.*, but...<br>
> <br>
> > +                  
      (ntohl(vmaddr) & 0xf0000000) == 0xf0000000 ||<br>
> <br>
> shouldn't this be (ntohl(vmaddr) & 0xff000000) == 0xff000000,
so that<br>
> you are not excluding 254.*?<br>
> </font></tt>
<br>
<br><tt><font size=2>Looking at Wikipedia for this</font></tt>
<br>
<br><a href=http://en.wikipedia.org/wiki/Classful_network><tt><font size=2>http://en.wikipedia.org/wiki/Classful_network</font></tt></a>
<br>
<br><tt><font size=2>Class D addresses have highest bits with pattern 1110
0000 -> 0xe0</font></tt>
<br><tt><font size=2>Class E addresses have highest bits with pattern 1111
0000 -> 0xf0</font></tt>
<br>
<br><tt><font size=2>I think my masks are fine and the masking with 0xf0
00 00 00 should also include 254.*  =  0xfe.*  .</font></tt>
<br>
<br><tt><font size=2>   Stefan</font></tt>
<br>