RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1691358 - Network filters are not honouring explicitly listed parameters for MAC
Summary: Network filters are not honouring explicitly listed parameters for MAC
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Daniel Berrangé
QA Contact: yalzhang@redhat.com
URL:
Whiteboard:
Depends On: 1691352
Blocks: 1691356
TreeView+ depends on / blocked
 
Reported: 2019-03-21 13:24 UTC by Daniel Berrangé
Modified: 2019-08-06 13:15 UTC (History)
7 users (show)

Fixed In Version: libvirt-4.5.0-16.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1691352
Environment:
Last Closed: 2019-08-06 13:14:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:2294 0 None None None 2019-08-06 13:15:24 UTC

Description Daniel Berrangé 2019-03-21 13:24:52 UTC
Should affect libvirt-4.5.0-10.el7_6.6 too given the upstream commit

+++ This bug was initially created as a clone of Bug #1691352 +++

Description of problem:

When using a network filter, libvirt will automatically set a MAC parameter, and sometimes a IP parameter too.

These defaults are not always correct, so the user is supposed to be able to override them, for example to list multiple values:

    <interface type='network'>
      <mac address='52:54:00:7b:35:93'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <filterref filter='clean-traffic'>
        <parameter name='IP' value='104.207.129.11'/>
        <parameter name='IP' value='104.207.129.12'/>
        <parameter name='MAC' value='52:54:00:7b:35:93'/>
        <parameter name='MAC' value='52:54:00:7b:35:94'/>
      </filterref>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

Unfortunately a bug in refactoring of nwfilter led to the overrides no longer being honoured for MAC, and sometimes not honoured for IP

This is due to upstream commit d1a7c08eb in 4.5.0

Version-Release number of selected component (if applicable):
libvirt-5.0.0-7.el8

How reproducible:


Steps to Reproduce:
1. Create a guest with nwfilter referencing 'clean-traffic' and add 2 IP and 2 MAC address parameters in the XML
2. Start the guest
3. Look at the 'virsh nwfilter-binding-dumpxml $TAPDEVNAME' output to validate the parameters are still present

Actual results:
The parameters are sometimes missing

Expected results:
The parameters from domain XML are copied to nwfilter binding XML

Comment 3 Daniel Berrangé 2019-03-22 10:58:20 UTC
Upstream fix

commit 01e11ebcb6e8f24662b7c67b70134c192785691c
Author: Nikolay Shirokovskiy <nshirokovskiy>
Date:   Wed Mar 20 16:05:59 2019 +0300

    nwfilter: fix adding std MAC and IP values to filter binding

Comment 9 yalzhang@redhat.com 2019-05-07 06:30:15 UTC
reproduce it on libvirt-4.5.0-10.el7_6.7.x86_64

1. Start a guest with interface as below:
# virsh dumpxml rhel7 | grep /interface -B13
    <interface type='network'>
      <mac address='52:54:00:6d:08:be'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <filterref filter='clean-traffic'>
        <parameter name='IP' value='1.2.3.4'/>
        <parameter name='IP' value='1.2.3.5'/>
        <parameter name='MAC' value='52:54:00:7b:35:93'/>
        <parameter name='MAC' value='52:54:00:7b:35:94'/>
      </filterref>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </interface>

2. Check the binding 
# virsh nwfilter-binding-dumpxml vnet0
<filterbinding>
  <owner>
    <name>rhel7</name>
    <uuid>af6edb97-34e8-4f66-a3c6-5ffdfb1922d0</uuid>
  </owner>
  <portdev name='vnet0'/>
  <mac address='52:54:00:6d:08:be'/>
  <filterref filter='clean-traffic'>
    <parameter name='IP' value='1.2.3.4'/>
    <parameter name='IP' value='1.2.3.5'/>
   ** <parameter name='MAC' value='52:54:00:6d:08:be'/> **  ===> the mac is updated to the interface's mac
  </filterref>
</filterbinding>

3. Test on libvirt-4.5.0-16.el7.x86_64, the result is as expected, the binding keeps no changes.
# virsh dumpxml rhel | grep /interface -B13
    <interface type='network'>
      <mac address='52:54:00:7b:35:93'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <filterref filter='clean-traffic'>
        <parameter name='IP' value='104.207.129.11'/>
        <parameter name='IP' value='104.207.129.12'/>
        <parameter name='MAC' value='52:54:00:7b:35:93'/>
        <parameter name='MAC' value='52:54:00:7b:35:94'/>
      </filterref>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
# virsh nwfilter-binding-dumpxml vnet0
<filterbinding>
  <owner>
    <name>rhel</name>
    <uuid>2313f643-6c51-4706-8780-b1322acbd803</uuid>
  </owner>
  <portdev name='vnet0'/>
  <mac address='52:54:00:7b:35:93'/>
  <filterref filter='clean-traffic'>
    <parameter name='IP' value='104.207.129.11'/>
    <parameter name='IP' value='104.207.129.12'/>
    <parameter name='MAC' value='52:54:00:7b:35:93'/>
    <parameter name='MAC' value='52:54:00:7b:35:94'/>
  </filterref>
</filterbinding>

check the ebtables rules, the ip and mac both are correct as what we set:
# ebtables -t nat -L
Bridge table: nat

Bridge chain: PREROUTING, entries: 1, policy: ACCEPT
-i vnet0 -j libvirt-I-vnet0

Bridge chain: OUTPUT, entries: 0, policy: ACCEPT

Bridge chain: POSTROUTING, entries: 1, policy: ACCEPT
-o vnet0 -j libvirt-O-vnet0

Bridge chain: libvirt-I-vnet0, entries: 9, policy: ACCEPT
-j I-vnet0-mac
-p IPv4 -j I-vnet0-ipv4-ip
-p IPv4 -j ACCEPT 
-p ARP -j I-vnet0-arp-mac
-p ARP -j I-vnet0-arp-ip
-p ARP -j ACCEPT 
-p 0x8035 -j I-vnet0-rarp
-p 0x835 -j ACCEPT 
-j DROP 

Bridge chain: libvirt-O-vnet0, entries: 4, policy: ACCEPT
-p IPv4 -j O-vnet0-ipv4
-p ARP -j ACCEPT 
-p 0x8035 -j O-vnet0-rarp
-j DROP 

Bridge chain: I-vnet0-mac, entries: 3, policy: ACCEPT
-s 52:54:0:7b:35:93 -j RETURN 
-s 52:54:0:7b:35:94 -j RETURN 
-j DROP 

Bridge chain: I-vnet0-ipv4-ip, entries: 4, policy: ACCEPT
-p IPv4 --ip-src 0.0.0.0 --ip-proto udp -j RETURN 
-p IPv4 --ip-src 104.207.129.11 -j RETURN 
-p IPv4 --ip-src 104.207.129.12 -j RETURN 
-j DROP 

Bridge chain: O-vnet0-ipv4, entries: 1, policy: ACCEPT
-j ACCEPT 

Bridge chain: I-vnet0-arp-mac, entries: 3, policy: ACCEPT
-p ARP --arp-mac-src 52:54:0:7b:35:93 -j RETURN 
-p ARP --arp-mac-src 52:54:0:7b:35:94 -j RETURN 
-j DROP 

Bridge chain: I-vnet0-arp-ip, entries: 3, policy: ACCEPT
-p ARP --arp-ip-src 104.207.129.11 -j RETURN 
-p ARP --arp-ip-src 104.207.129.12 -j RETURN 
-j DROP 

Bridge chain: I-vnet0-rarp, entries: 3, policy: ACCEPT
-p 0x8035 -s 52:54:0:7b:35:93 -d Broadcast --arp-op Request_Reverse --arp-ip-src 0.0.0.0 --arp-ip-dst 0.0.0.0 --arp-mac-src 52:54:0:7b:35:93 --arp-mac-dst 52:54:0:7b:35:93 -j ACCEPT 
-p 0x8035 -s 52:54:0:7b:35:94 -d Broadcast --arp-op Request_Reverse --arp-ip-src 0.0.0.0 --arp-ip-dst 0.0.0.0 --arp-mac-src 52:54:0:7b:35:94 --arp-mac-dst 52:54:0:7b:35:94 -j ACCEPT 
-j DROP 

Bridge chain: O-vnet0-rarp, entries: 3, policy: ACCEPT
-p 0x8035 -d Broadcast --arp-op Request_Reverse --arp-ip-src 0.0.0.0 --arp-ip-dst 0.0.0.0 --arp-mac-src 52:54:0:7b:35:93 --arp-mac-dst 52:54:0:7b:35:93 -j ACCEPT 
-p 0x8035 -d Broadcast --arp-op Request_Reverse --arp-ip-src 0.0.0.0 --arp-ip-dst 0.0.0.0 --arp-mac-src 52:54:0:7b:35:94 --arp-mac-dst 52:54:0:7b:35:94 -j ACCEPT 
-j DROP

3. if no mac is set, the mac parameter in the nwfilter-binding xml will be the mac of the interface, which is expected.
# virsh dumpxml rhel | grep /interface -B8
    <interface type='network'>
      <mac address='52:54:00:7b:35:93'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <filterref filter='clean-traffic'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
# virsh nwfilter-binding-dumpxml vnet0
<filterbinding>
  <owner>
    <name>rhel</name>
    <uuid>2313f643-6c51-4706-8780-b1322acbd803</uuid>
  </owner>
  <portdev name='vnet0'/>
  <mac address='52:54:00:7b:35:93'/>
  <filterref filter='clean-traffic'>
    <parameter name='MAC' value='52:54:00:7b:35:93'/>
  </filterref>
</filterbinding>

4. check the ebtables rule, the mac is correct and ip address is learned.
# virsh domifaddr rhel
 Name       MAC address          Protocol     Address
-------------------------------------------------------------------------------
 vnet0      52:54:00:7b:35:93    ipv4         192.168.122.170/24
# ebtables -t nat -L
Bridge table: nat

Bridge chain: PREROUTING, entries: 1, policy: ACCEPT
-i vnet0 -j libvirt-I-vnet0

Bridge chain: OUTPUT, entries: 0, policy: ACCEPT

Bridge chain: POSTROUTING, entries: 1, policy: ACCEPT
-o vnet0 -j libvirt-O-vnet0

Bridge chain: libvirt-I-vnet0, entries: 9, policy: ACCEPT
-j I-vnet0-mac
-p IPv4 -j I-vnet0-ipv4-ip
-p IPv4 -j ACCEPT 
-p ARP -j I-vnet0-arp-mac
-p ARP -j I-vnet0-arp-ip
-p ARP -j ACCEPT 
-p 0x8035 -j I-vnet0-rarp
-p 0x835 -j ACCEPT 
-j DROP 

Bridge chain: libvirt-O-vnet0, entries: 4, policy: ACCEPT
-p IPv4 -j O-vnet0-ipv4
-p ARP -j ACCEPT 
-p 0x8035 -j O-vnet0-rarp
-j DROP 

Bridge chain: I-vnet0-mac, entries: 2, policy: ACCEPT
-s 52:54:0:7b:35:93 -j RETURN 
-j DROP 

Bridge chain: I-vnet0-ipv4-ip, entries: 3, policy: ACCEPT
-p IPv4 --ip-src 0.0.0.0 --ip-proto udp -j RETURN 
-p IPv4 --ip-src 192.168.122.170 -j RETURN 
-j DROP 

Bridge chain: O-vnet0-ipv4, entries: 1, policy: ACCEPT
-j ACCEPT 

Bridge chain: I-vnet0-arp-mac, entries: 2, policy: ACCEPT
-p ARP --arp-mac-src 52:54:0:7b:35:93 -j RETURN 
-j DROP 

Bridge chain: I-vnet0-arp-ip, entries: 2, policy: ACCEPT
-p ARP --arp-ip-src 192.168.122.170 -j RETURN 
-j DROP 

Bridge chain: I-vnet0-rarp, entries: 2, policy: ACCEPT
-p 0x8035 -s 52:54:0:7b:35:93 -d Broadcast --arp-op Request_Reverse --arp-ip-src 0.0.0.0 --arp-ip-dst 0.0.0.0 --arp-mac-src 52:54:0:7b:35:93 --arp-mac-dst 52:54:0:7b:35:93 -j ACCEPT 
-j DROP 

Bridge chain: O-vnet0-rarp, entries: 2, policy: ACCEPT
-p 0x8035 -d Broadcast --arp-op Request_Reverse --arp-ip-src 0.0.0.0 --arp-ip-dst 0.0.0.0 --arp-mac-src 52:54:0:7b:35:93 --arp-mac-dst 52:54:0:7b:35:93 -j ACCEPT 
-j DROP

Comment 11 errata-xmlrpc 2019-08-06 13:14:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:2294


Note You need to log in before you can comment on or make changes to this bug.