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, 24 Mar 2016 13:09:25 GMT


ASF GitHub Bot commented on CLOUDSTACK-9317:

Github user rafaelweingartner commented on a diff in the pull request:
    --- Diff: server/test/com/cloud/network/ ---
    @@ -0,0 +1,71 @@
    +// Licensed to the Apache Software Foundation (ASF) under one
    +// or more contributor license agreements.  See the NOTICE file
    +// distributed with this work for additional information
    +// regarding copyright ownership.  The ASF licenses this file
    +// to you under the Apache License, Version 2.0 (the
    +// "License"); you may not use this file except in compliance
    +// with the License.  You may obtain a copy of the License at
    +// Unless required by applicable law or agreed to in writing,
    +// software distributed under the License is distributed on an
    +// KIND, either express or implied.  See the License for the
    +// specific language governing permissions and limitations
    +// under the License.
    +import org.junit.Assert;
    +import org.junit.Before;
    +import org.junit.Test;
    +import org.mockito.InjectMocks;
    +import org.mockito.Mock;
    +import org.mockito.MockitoAnnotations;
    +import static org.mockito.Mockito.when;
    +import java.util.Collections;
    +import java.util.List;
    +import static org.mockito.Mockito.anyLong;
    +import static org.mockito.Mockito.mock;
    +public class IpAddressManagerTest {
    +    @Mock
    +    IPAddressDao _ipAddrDao;
    +    @InjectMocks
    +    IpAddressManagerImpl _ipManager;
    +    @Before
    +    public void setup() {
    +        MockitoAnnotations.initMocks(this);
    +    }
    +    @Test
    +    public void testGetStaticNatSourceIps() {
    +        String publicIpAddress = "";
    +        IPAddressVO vo = mock(IPAddressVO.class);
    +        when(vo.getAddress()).thenReturn(new Ip(publicIpAddress));
    +        when(vo.getId()).thenReturn(1l);
    +        when(_ipAddrDao.findById(anyLong())).thenReturn(vo);
    +        StaticNat snat = new StaticNatImpl(1, 1, 1, 1, publicIpAddress, false);
    +        List<IPAddressVO> ips = _ipManager.getStaticNatSourceIps(Collections.singletonList(snat));
    +        Assert.assertNotNull(ips);
    +        Assert.assertEquals(1, ips.size());
    --- End diff --
    I would also add a check here to confirm that the ipAddrDao was called only once.

> 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