提交 4021b85f 编写于 作者: S Stefan Berger 提交者: Daniel Veillard

nwfilter: adapt IP learning for broadcasted DHCP replies

Adapt the IP learning code to also accept broadcasted DHCP replies
上级 c828a746
...@@ -414,9 +414,7 @@ learnIPAddressThread(void *arg) ...@@ -414,9 +414,7 @@ learnIPAddressThread(void *arg)
req->status = EINVAL; req->status = EINVAL;
goto done; goto done;
} }
virBufferAsprintf(&buf, " ether dst %s" virBufferAsprintf(&buf, "src port 67 and dst port 68");
" and src port 67 and dst port 68",
macaddr);
break; break;
default: default:
if (techdriver->applyBasicRules(req->ifname, if (techdriver->applyBasicRules(req->ifname,
...@@ -424,7 +422,8 @@ learnIPAddressThread(void *arg) ...@@ -424,7 +422,8 @@ learnIPAddressThread(void *arg)
req->status = EINVAL; req->status = EINVAL;
goto done; goto done;
} }
virBufferAsprintf(&buf, "ether host %s", macaddr); virBufferAsprintf(&buf, "ether host %s or ether dst ff:ff:ff:ff:ff:ff",
macaddr);
} }
if (virBufferError(&buf)) { if (virBufferError(&buf)) {
...@@ -529,7 +528,9 @@ learnIPAddressThread(void *arg) ...@@ -529,7 +528,9 @@ learnIPAddressThread(void *arg)
} }
} }
} else if (virMacAddrCmpRaw(&req->macaddr, } else if (virMacAddrCmpRaw(&req->macaddr,
ether_hdr->ether_dhost) == 0) { ether_hdr->ether_dhost) == 0 ||
/* allow Broadcast replies from DHCP server */
virMacAddrIsBroadcastRaw(ether_hdr->ether_dhost)) {
/* packets to the VM */ /* packets to the VM */
if (etherType == ETHERTYPE_IP && if (etherType == ETHERTYPE_IP &&
(header.len >= ethHdrSize + (header.len >= ethHdrSize +
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册