From db5ed32b0eb8374ccfd9660d089bd17bb57a9709 Mon Sep 17 00:00:00 2001 Message-Id: <db5ed32b0eb8374ccfd9660d089bd17bb57a9709.1283957680.git.jdenemar@redhat.com> From: Stefan Berger <stefanb@us.ibm.com> Date: Fri, 13 Aug 2010 16:41:39 -0400 Subject: [PATCH] nwfilter: Discard class D,E IP addresses when sniffing pkts Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=630574 When sniffing the network traffic, discard class D and E IP addresses when sniffing traffic. This was a reason why filters were not correctly rebuilt on VMs on the local 192.* network when libvirt was restarted and those VMs did not use a DHCP request to get its IP address. (cherry picked from commit 753d76e0cd3554acb6c087d1ce3a2aa6f1dda203) --- src/nwfilter/nwfilter_learnipaddr.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c index 71dc240..b4536a8 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -546,9 +546,11 @@ learnIPAddressThread(void *arg) struct iphdr *iphdr = (struct iphdr*)(packet + ethHdrSize); vmaddr = iphdr->saddr; - // skip eth. bcast and mcast addresses, - // and zero address in DHCP Requests - if ((ntohl(vmaddr) & 0xc0000000) || vmaddr == 0) { + // skip mcast addresses (224.0.0.0 - 239.255.255.255), + // class E (240.0.0.0 - 255.255.255.255, includes eth. + // bcast) and zero address in DHCP Requests + if ( (ntohl(vmaddr) & 0xe0000000) == 0xe0000000 || + vmaddr == 0) { vmaddr = 0; continue; } -- 1.7.2.2