cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (CLOUDSTACK-9317) Disabling static NAT on many IPs can leave wrong IPs on the router
Date Thu, 04 Aug 2016 21:17:20 GMT


ASF GitHub Bot commented on CLOUDSTACK-9317:

Github user jburwell commented on a diff in the pull request:
    --- Diff: server/src/com/cloud/network/ ---
    @@ -1698,6 +1698,22 @@ public String acquireGuestIpAddress(Network network, String requestedIp)
         Random _rand = new Random(System.currentTimeMillis());
    +    /**
    +     * Get the list of public IPs that need to be applied for a static NAT enable/disable
    +     * Manipulating only these ips prevents concurrency issues when disabling static
nat at the same time.
    +     * @param staticNats
    +     * @return The list of IPs that need to be applied for the static NAT to work.
    +     */
    +    public List<IPAddressVO> getStaticNatSourceIps(List<? extends StaticNat>
staticNats) {
    +        List<IPAddressVO> userIps = new ArrayList<>();
    +        for (StaticNat snat : staticNats) {
    +            userIps.add(_ipAddressDao.findById(snat.getSourceIpAddressId()));
    +        }
    --- End diff --
    Executing queries in a ``for`` loop in unnecessarily expensive.  Could you please refactor
this ``for`` loop into a new method on ``IPAddressDao`` that retrieves a list of IP addresses
for a list of IPs?

> Disabling static NAT on many IPs can leave wrong IPs on the router
> ------------------------------------------------------------------
>                 Key: CLOUDSTACK-9317
>                 URL:
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: Management Server, Virtual Router
>    Affects Versions: 4.7.0, 4.7.1, 4.7.2
>            Reporter: Jeff Hair
> The current behavior of enabling or disabling static NAT will call the apply IP associations
method in the management server. The method is not thread-safe. If it's called from multiple
threads, each thread will load up the list of public IPs in different states (add or revoke)--correct
for the thread, but not correct overall. Depending on execution order on the virtual router,
the router can end up with public IPs assigned to it that are not supposed to be on it anymore.
When another account acquires the same IP, this of course leads to network problems.
> The problem has been in CS since at least 4.2, and likely affects all recently released
versions. Affected version is set to 4.7.x because that's what we verified against.

This message was sent by Atlassian JIRA

View raw message