IPv4 Subnetze <= /25 bug
-
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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login