1. 17 7月, 2012 2 次提交
    • M
      nwfilter: Convert to virMacAddrPtr completely · 14197c74
      Michal Privoznik 提交于
      The previous commit (387117ad) was incomplete leaving those
      who does not use libpcap with uncompilable sources beacuse
      of incomplete conversion of virNWFilterDHCPSnoopReq function.
      14197c74
    • S
      Convert 'raw MAC address' usages to use virMacAddr · 387117ad
      Stefan Berger 提交于
      Introduce new members in the virMacAddr 'class'
      - virMacAddrSet: set virMacAddr from a virMacAddr
      - virMacAddrSetRaw: setting virMacAddr from raw 6 byte MAC address buffer
      - virMacAddrGetRaw: writing virMacAddr into raw 6 byte MAC address buffer
      - virMacAddrCmp: comparing two virMacAddr
      - virMacAddrCmpRaw: comparing a virMacAddr with a raw 6 byte MAC address buffer
      
      then replace raw MAC addresses by replacing
      
      - 'unsigned char *' with virMacAddrPtr
      - 'unsigned char ... [VIR_MAC_BUFLEN]' with virMacAddr
      
      and introduce usage of above functions where necessary.
      387117ad
  2. 15 6月, 2012 1 次提交
  3. 02 6月, 2012 2 次提交
    • S
      nwfilter: Add multiple IP address support to DHCP snooping · b92d52d3
      Stefan Berger 提交于
      With support for multiple IP addresses per interface in place, this patch
      now adds support for multiple IP addresses per interface for the DHCP
      snooping code.
      
      
      Testing:
      
      Since the infrastructure I tested this with does not provide multiple IP
      addresses per MAC address (anymore), I either had to plug the VM's interface
      from the virtual bride connected directly to the infrastructure to virbr0
      to get a 2nd IP address from dnsmasq (kill and run dhclient inside the VM)
      or changed the lease file  (/var/run/libvirt/network/nwfilter.leases) and
      restart libvirtd to have a 2nd IP address on an existing interface.
      Note that dnsmasq can take a lease timeout parameter as part of the --dhcp-range
      command line parameter, so that timeouts can be tested that way
      (--dhcp-range 192.168.122.2,192.168.122.254,120). So, terminating and restarting
      dnsmasq with that parameter is another choice to watch an IP address disappear
      after 120 seconds.
      
      Regards,
         Stefan
      b92d52d3
    • S
      nwfilter: add DHCP snooping · cec281fc
      Stefan Berger 提交于
      This patch adds DHCP snooping support to libvirt. The learning method for
      IP addresses is specified by setting the "CTRL_IP_LEARNING" variable to one of
      "any" [default] (existing IP learning code), "none" (static only addresses)
      or "dhcp" (DHCP snooping).
      
      Active leases are saved in a lease file and reloaded on restart or HUP.
      
      The following interface XML activates and uses the DHCP snooping:
      
          <interface type='bridge'>
            <source bridge='virbr0'/>
            <filterref filter='clean-traffic'>
              <parameter name='CTRL_IP_LEARNING' value='dhcp'/>
            </filterref>
          </interface>
      
      All filters containing the variable 'IP' are automatically adjusted when
      the VM receives an IP address via DHCP. However, multiple IP addresses per
      interface are silently ignored in this patch, thus only supporting one IP
      address per interface. Multiple IP address support is added in a later
      patch in this series.
      Signed-off-by: NDavid L Stevens <dlstevens@us.ibm.com>
      Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      cec281fc