Community
    • Categories
    • Recent
    • Popular
    • Users
    • Search
    • Register
    • Login

    IPv4 Subnetze <= /25 bug

    Scheduled Pinned Locked Moved Entwicklung
    1 Posts 1 Posters 1.0k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F Offline
      freddy
      last edited by

      Hallo,

      In i-doit 0.9.9-8 ist es nicht möglich beliebige Subnets welche kleiner als /25 sind anzulegen.
      Das letzte Oktet wird dabei immer auf 0 gesetzt.
      z.B. wenn man 192.168.0.128/25 anlegen will wird die Netz IP immer auf 192.168.0.0 gesetzt.

      Der Fehler befindet sich in der validate_net_ip Javascript Funktion. Die Absicht des Autors warum das letzte Oktet in diesen Fällen auf 0 gesetzt wird verstehe ich nicht wirklich.

      Folgender Patch sollte das Problem lösen:

      
      --- a/src/themes/default/smarty/templates/content/bottom/content/cats__net.tpl
      +++ b/src/themes/default/smarty/templates/content/bottom/content/cats__net.tpl
      @@ -98,22 +98,8 @@ window.calcNetmask = function(cidr) {
       }
      
       window.validate_net_ip = function(){
      -
      -       var net_ident = 'C__CATS__NET__NET_V4';
      -       var from_ident = 'C__CATS__NET__ADDRESS_RANGE_FROM_V4';
      -
              for(var i = 0; i < 4; i++){
      -               if(i < 3){
      -                       if($(net_ident+'['+i+']').value != $(from_ident+'['+i+']').value){
      -                               $(net_ident+'['+i+']').value = $(from_ident+'['+i+']').value;
      -                       }
      -               } else{
      -                       if($(net_ident+'['+i+']').value != ($(from_ident+'['+i+']').value-1)){
      -                               $(net_ident+'['+i+']').value = ($(from_ident+'['+i+']').value-1);
      -                       } else{
      -                               $(net_ident+'['+i+']').value = 0;
      -                       }
      -               }
      +               $('C__CATS__NET__NET_V4['+i+']').value &= $('C__CATS__NET__MASK_V4['+i+']').value;
              }
       }
      

      Die ganzen Logik die ich nicht nachvollziehen kann wird ersetzt durch eine ziemlich simple:
      NET_IP = IP & NET_MASK

      1 Reply Last reply Reply Quote 0
      • First post
        Last post