Menu

#225 Overlapping check does not work - Fixes provided

1.0
closed
nobody
overlapping (1)
8
2016-11-09
2014-08-25
Anonymous
No

Within the verifyNestedSubnetOverlapping function in functions-network.php, there is a bug that prevents checking of overlapping subnets:
if($existingSubnet['id'] = $kp) {
should be
if($existingSubnet['id'] == $kp) {
I guess.

Also in manageSubnetEditResult.php at line #85:
if($section['strictMode'] == 1 && !$isFolder) {
should be
if ($section['strictMode'] == 1 ) {

because $isFolder is always set to true if the masterSubnetId is 0 and the if:
else if (($_POST['action'] == "add") && ($_POST['masterSubnetId'] == 0)) {
wouldn't make any sense.

Could you please fix this in the upcoming versions?

Discussion

  • Anonymous

    Anonymous - 2014-08-25

    ah damn, no it always says overlapping

     
  • Anonymous

    Anonymous - 2014-08-25

    Okay, I think it works now like this:

    $allParents = getAllParents($masterSubnetId);
    foreach ($allParents as $kp => $p) {
    if ($existingSubnet['id'] == $p) { // $kp is either 0 or 1, so use $p instead and of course == instead of =
    $ignore = true;
    }
    }
    if ($masterSubnetId == $existingSubnet['id']) { //don't check against the masterSubnet
    $ignore = true;
    }

    AND:
    add a "$ignore = false;" at the top of the foreach loop, otherwise once it's true it's always true...

     
  • Ciro Iriarte

    Ciro Iriarte - 2014-09-18

    Hmm, I'm seeing the same on 1.01. I introduced the "fixes" proposed by the Anonymous and now it works as expected, but I'm unsure if it breaks something else (there might be use cases I don't see/need).

    Could you please review the patch?

     
  • Ciro Iriarte

    Ciro Iriarte - 2014-09-19

    OK, first issue with the patch. I you put the subnets in folders, the check doesn't work.

     
  • Anonymous

    Anonymous - 2014-10-24

    Well, but how do you use the folders?
    I mean, if I got one folder with the subnets 192.168.0.0/16 -> (child) 192.168.1.0/24

    And now I want to put the child subnet into a new folder called "Test". What exactly do you want do be checked? Should it be checked with all other subnets within the section?
    Because then you couldn't put any 192.168.0.0 network in a folder.

    I personally don't use the folders, so it depends on how you want to use them.

    Would be great, if you can answer me this question so I might provide a bugfix :)

     
  • Miha Petkovsek

    Miha Petkovsek - 2014-11-22

    Can someone checks this on original file:

    /* get master subnet details for folder overrides */
    if($_POST['masterSubnetId']!="0")   {
        $mSection = getSubnetDetailsById($_POST['masterSubnetId']);
        if($mSection['isFolder']=="1")  { $isFolder = true; }
        else                            { $isFolder = false; }
    } 
    else                                { $isFolder = false; }
    

    Just change the last true to false.

     
  • Miha Petkovsek

    Miha Petkovsek - 2014-11-28

    Fixed, will be available in 1.1

     
  • Miha Petkovsek

    Miha Petkovsek - 2014-11-28
    • status: open --> closed
     
  • Anonymous

    Anonymous - 2016-01-15

    This is still a problem in 1.1, FYI

     
  • Anonymous

    Anonymous - 2016-04-05
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2016-11-09
    Post awaiting moderation.

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB