1. 10 4月, 2019 1 次提交
  2. 22 2月, 2019 1 次提交
  3. 14 12月, 2018 1 次提交
    • D
      Remove all Author(s): lines from source file headers · 60046283
      Daniel P. Berrangé 提交于
      In many files there are header comments that contain an Author:
      statement, supposedly reflecting who originally wrote the code.
      In a large collaborative project like libvirt, any non-trivial
      file will have been modified by a large number of different
      contributors. IOW, the Author: comments are quickly out of date,
      omitting people who have made significant contribitions.
      
      In some places Author: lines have been added despite the person
      merely being responsible for creating the file by moving existing
      code out of another file. IOW, the Author: lines give an incorrect
      record of authorship.
      
      With this all in mind, the comments are useless as a means to identify
      who to talk to about code in a particular file. Contributors will always
      be better off using 'git log' and 'git blame' if they need to  find the
      author of a particular bit of code.
      
      This commit thus deletes all Author: comments from the source and adds
      a rule to prevent them reappearing.
      
      The Copyright headers are similarly misleading and inaccurate, however,
      we cannot delete these as they have legal meaning, despite being largely
      inaccurate. In addition only the copyright holder is permitted to change
      their respective copyright statement.
      Reviewed-by: NErik Skultety <eskultet@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      60046283
  4. 24 9月, 2018 1 次提交
  5. 07 8月, 2018 3 次提交
  6. 06 4月, 2018 3 次提交
  7. 26 5月, 2017 1 次提交
  8. 23 5月, 2017 1 次提交
  9. 19 12月, 2016 1 次提交
    • J
      util: Introduce virSocketAddrPTRDomain · acd547dc
      Jiri Denemark 提交于
      The API creates PTR domain which corresponds to a given addr/prefix.
      Both IPv4 and IPv6 addresses are supported, but the prefix must be
      divisible by 8 for IPv4 and divisible by 4 for IPv6.
      
      The generated PTR domain has the following format
      
      IPv4: 1.2.3.4.in-addr.arpa
      IPv6: 0.1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.0.1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.ip6.arpa
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      acd547dc
  10. 27 6月, 2016 2 次提交
    • L
      util: allow calling virSocketAddrGetIPPrefix with NULL netmask or address · 9359167e
      Laine Stump 提交于
      There are times when we don't have a netmask pointer to give to
      virSocketAddrGetIPPrefix() (e.g. the IP addresses in domain interfaces
      only have a prefix, no netmask), but it would have caused a segv if we
      called it with NULL instead of a pointer to a netmask. This patch
      qualifies the code that would use the netmask or address pointers to
      check for NULL first.
      9359167e
    • L
      global: consistently use IP rather than Ip in identifiers · 22a6873a
      Laine Stump 提交于
      I'm tired of mistyping this all the time, so let's do it the same all
      the time (similar to how we changed all "Pci" to "PCI" awhile back).
      
      (NB: I've left alone some things in the esx and vbox drivers because
      I'm unable to compile them and they weren't obviously *not* a part of
      some API. I also didn't change a couple of variables named,
      e.g. "somethingIptables", because they were derived from the name of
      the "iptables" command)
      22a6873a
  11. 30 5月, 2016 1 次提交
    • M
      virSocketAddrIsPrivate: Work on 32bits platforms · 2bd61c84
      Michal Privoznik 提交于
      Yet another one of those where signed int (or long int) is not
      enough. And useless to as we're aiming at unsigned anyway.
      
      ../../src/util/virsocketaddr.c: In function 'virSocketAddrIsPrivate':
      ../../src/util/virsocketaddr.c:289:45: error: result of '192l << 24' requires 33 bits to represent, but 'long int' only has 32 bits [-Werror=shift-overflow=]
              return ((val & 0xFFFF0000) == ((192L << 24) + (168 << 16)) ||
                                                   ^~
      ../../src/util/virsocketaddr.c:290:45: error: result of '172l << 24' requires 33 bits to represent, but 'long int' only has 32 bits [-Werror=shift-overflow=]
                      (val & 0xFFF00000) == ((172L << 24) + (16  << 16)) ||
                                                   ^~
      cc1: all warnings being treated as errors
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      2bd61c84
  12. 03 5月, 2016 1 次提交
    • E
      virnetsocket: Provide socket address format in a more standard form · 9b45c9f0
      Erik Skultety 提交于
      Our socket address format is in a rather non-standard format and that is
      because sasl library requires the IP address and service to be delimited by a
      semicolon. The string form is a completely internal matter, however once the
      admin interfaces to retrieve client identity information are merged, we should
      return the socket address string in a common format, e.g. format defined by
      URI rfc-3986, i.e. the IP address and service are delimited by a colon and
      in case of an IPv6 address, square brackets are added:
      
      Examples:
          127.0.0.1:1234
          [::1]:1234
      
      This patch changes our default format to the one described above, while adding
      separate methods to request the non-standard SASL format using semicolon as a
      delimiter.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      9b45c9f0
  13. 21 3月, 2016 1 次提交
    • M
      util: Add virSocketAddrSetIPv[46]AddrNetOrder and use it · 573c41a2
      Martin Kletzander 提交于
      This allows setting the address in host and/or network order and makes
      the naming consistent.  Now you don't need to call [hn]to[nh]l()
      functions as that is taken care of by these functions.  Also, now
      the *NetOrder take the address in network order, the other functions in
      host order so the naming and usage is consistent.  Some places were
      having the address in network order and calling ntohl() just so the
      original function can call htonl() again.  This makes it nicer to read.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      573c41a2
  14. 19 3月, 2016 1 次提交
  15. 11 8月, 2015 1 次提交
    • L
      network: validate network NAT range · a6f9af82
      Laine Stump 提交于
      This patch modifies virSocketAddrGetRange() to function properly when
      the containing network/prefix of the address range isn't known, for
      example in the case of the NAT range of a virtual network (since it is
      a range of addresses on the *host*, not within the network itself). We
      then take advantage of this new functionality to validate the NAT
      range of a virtual network.
      
      Extra test cases are also added to verify that virSocketAddrGetRange()
      works properly in both positive and negative cases when the network
      pointer is NULL.
      
      This is the *real* fix for:
      
      https://bugzilla.redhat.com/show_bug.cgi?id=985653
      
      Commits 1e334a and 48e8b9 had earlier been pushed as fixes for that
      bug, but I had neglected to read the report carefully, so instead of
      fixing validation for the NAT range, I had fixed validation for the
      DHCP range. sigh.
      a6f9af82
  16. 03 6月, 2015 3 次提交
    • M
      util: Clear output broadcast address before filling it in · 99cc11b9
      Martin Kletzander 提交于
      Since commit 55ace7c4, the sockettest
      fails without VIR_TEST_DEBUG set.  The problem is found by test number
      42 (co-incidence?), which tests range '192.168.122.1' -
      '192.168.122.255' in network '192.168.122.0/24'.  That is supposed to
      fail because the end address is equal to the broadcast address.
      
      When comparing these two in 'virSocketAddrEqual(end, &broadcast)',
      there is a check for sin_addr as well as for sin_port.  That port,
      however, is different when we do not enable test debugging.  With the
      testing enabled, the port is 0 (correctly initialized), but without that
      it has a random number there.  And that's because the structure is not
      initialized anywhere.
      
      By zeroing the structure before filling in the info, we make sure we
      return only the address and not any information that was not requested.
      And the test work once again.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      99cc11b9
    • L
      util: report all address range errors in virSocketAddrGetRange() · 55ace7c4
      Laine Stump 提交于
      There are now many more reasons that virSocketAddrGetRange() could
      fail, so it is much more informative to report the error there instead
      of in the caller. (one of the two callers was previously assuming
      success, which is almost surely safe based on the parsing that has
      already happened to the config by that time, but it still is nicer to
      account for an error "just in case")
      
      Part of fix for: https://bugzilla.redhat.com/show_bug.cgi?id=985653
      55ace7c4
    • L
      network: validate DHCP ranges are completely within defined network · 1e334a0a
      Laine Stump 提交于
      virSocketAddrGetRange() has been updated to take the network address
      and prefix, and now checks that both the start and end of the range
      are within that network, thus validating that the entire range of
      addresses is in the network. For IPv4, it also checks that ranges to
      not start with the "network address" of the subnet, nor end with the
      broadcast address of the subnet (this check doesn't apply to IPv6,
      since IPv6 doesn't have a broadcast or network address)
      
      Negative tests have been added to the network update and socket tests
      to verify that bad ranges properly generate an error.
      
      This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=985653
      1e334a0a
  17. 17 1月, 2015 1 次提交
  18. 16 1月, 2015 1 次提交
  19. 22 10月, 2014 1 次提交
    • R
      Fix cast errors with clang · 82e4f85c
      Roman Bogorodskiy 提交于
      Build with clang fails with:
      
        CC       util/libvirt_util_la-virsocketaddr.lo
      util/virsocketaddr.c:904:17: error: cast from 'struct sockaddr *' to
      'struct sockaddr_in *' increases required alignment from 1 to 4
      [-Werror,-Wcast-align]
              inet4 = (struct sockaddr_in*) res->ai_addr;
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      util/virsocketaddr.c:909:17: error: cast from 'struct sockaddr *' to
      'struct sockaddr_in6 *' increases required alignment from 1 to 4
      [-Werror,-Wcast-align]
              inet6 = (struct sockaddr_in6*) res->ai_addr;
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      2 errors generated.
      
      Fix that by replacing virSocketAddrParseInternal() call with
      virSocketAddrParse() in the virSocketAddrIsNumericLocalhost() function.
      virSocketAddrParse stores an address in virSocketAddr.
      virSocketAddr uses a union to store an address, so it doesn't
      need casting.
      82e4f85c
  20. 15 10月, 2014 4 次提交
  21. 05 9月, 2014 1 次提交
    • E
      maint: use consistent if-else braces in remaining spots · d194d6e7
      Eric Blake 提交于
      I'm about to add a syntax check that enforces our documented
      HACKING style of always using matching {} on if-else statements.
      
      This patch focuses on all remaining problems, where there weren't
      enough issues to warrant splitting it further.
      
      * src/remote/remote_driver.c (doRemoteOpen): Correct use of {}.
      * src/security/virt-aa-helper.c (vah_add_path, valid_path, main):
      Likewise.
      * src/rpc/virnetsocket.c (virNetSocketNewConnectLibSSH2):
      Likewise.
      * src/esx/esx_vi_types.c (esxVI_Type_FromString): Likewise.
      * src/uml/uml_driver.c (umlDomainDetachDevice): Likewise.
      * src/util/viralloc.c (virShrinkN): Likewise.
      * src/util/virbuffer.c (virBufferURIEncodeString): Likewise.
      * src/util/virdbus.c (virDBusCall): Likewise.
      * src/util/virnetdev.c (virNetDevValidateConfig): Likewise.
      * src/util/virnetdevvportprofile.c
      (virNetDevVPortProfileGetNthParent): Likewise.
      * src/util/virpci.c (virPCIDeviceIterDevices)
      (virPCIDeviceWaitForCleanup)
      (virPCIDeviceIsBehindSwitchLackingACS): Likewise.
      * src/util/virsocketaddr.c (virSocketAddrGetNumNetmaskBits):
      Likewise.
      * src/util/viruri.c (virURIParseParams): Likewise.
      * daemon/stream.c (daemonStreamHandleAbort): Likewise.
      * tests/testutils.c (virtTestResult): Likewise.
      * tests/cputest.c (cpuTestBaseline): Likewise.
      * tools/virsh-domain.c (cmdDomPMSuspend): Likewise.
      * tools/virsh-host.c (cmdNodeSuspend): Likewise.
      * src/esx/esx_vi_generator.py (Type.generate_typefromstring):
      Tweak generated code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d194d6e7
  22. 25 3月, 2014 1 次提交
  23. 21 3月, 2014 1 次提交
  24. 20 3月, 2014 1 次提交
    • D
      Fix unitialized data in virSocketAddrMask · ba08c593
      Daniel P. Berrange 提交于
      The virSocketAddrMask method did not initialize all fields
      in the sockaddr_in6 struct. In paticular the 'sin6_scope_id'
      field could contain random garbage, which would in turn
      affect the result of any later virSocketAddrFormat calls.
      This led to ip6tables rules in the FORWARD chain which
      matched on random garbage sin6_scope_id. Fortunately these
      were ACCEPT rules, so the impact was merely that desired
      traffic was blocked, rather than undesired traffic allowed.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ba08c593
  25. 15 10月, 2013 1 次提交
    • E
      maint: avoid 'const fooPtr' in several util files · 1b0bc416
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up offenders in src/util outside of the virnet namespace.
      
      Also, make a few virSocketAddr functions const-correct, for easier
      conversions in future patches.
      
      * src/util/virbuffer.h (virBufferError, virBufferUse)
      (virBufferGetIndent): Use intended type.
      * src/util/virmacaddr.h (virMacAddrCmp, virMacAddrCmpRaw)
      (virMacAddrSet, virMcAddrFormat, virMacAddrIsUnicast)
      (virMacAddrIsMulticast): Likewise.
      * src/util/virebtables.h (ebtablesAddForwardAllowIn)
      (ebtablesRemoveForwardAllowIn): Likewise.
      * src/util/virsocketaddr.h (virSocketAddrSetIPv4Addr): Drop
      incorrect const.
      (virMacAddrGetRaw, virSocketAddrFormat, virSocketAddrFormatFull):
      Make const-correct.
      (virSocketAddrMask, virSocketAddrMaskByPrefix)
      (virSocketAddrBroadcast, virSocketAddrBroadcastByPrefix)
      (virSocketAddrGetNumNetmaskBits, virSocketAddrGetIpPrefix)
      (virSocketAddrEqual, virSocketAddrIsPrivate)
      (virSocketAddrIsWildcard): Use intended type.
      * src/util/virbuffer.c (virBufferError, virBufferUse)
      (virBufferGetIndent): Fix fallout.
      * src/util/virmacaddr.c (virMacAddrCmp, virMacAddrCmpRaw)
      (virMacAddrSet, virMcAddrFormat, virMacAddrIsUnicast)
      (virMacAddrIsMulticast): Likewise.
      * src/util/virebtables.c (ebtablesAddForwardAllowIn)
      (ebtablesRemoveForwardAllowIn): Likewise.
      * src/util/virsocketaddr.c (virSocketAddrMask, virMacAddrGetRaw)
      (virSocketAddrMaskByPrefix, virSocketAddrBroadcast)
      (virSocketAddrBroadcastByPrefix, virSocketAddrGetNumNetmaskBits)
      (virSocketAddrGetIpPrefix, virSocketAddrEqual)
      (virSocketAddrIsPrivate, virSocketAddrIsWildcard)
      (virSocketAddrGetIPv4Addr, virSocketAddrGetIPv6Addr)
      (virSocketAddrFormat, virSocketAddrFormatFull): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1b0bc416
  26. 11 10月, 2013 1 次提交
  27. 11 7月, 2013 1 次提交
  28. 10 7月, 2013 1 次提交
  29. 28 6月, 2013 1 次提交
  30. 10 6月, 2013 1 次提交