File tree Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -155,29 +155,25 @@ var sonar = {
155155 }
156156
157157 // Queue IP address range
158- var d = ip_min [ 3 ] + 1 ;
159- for ( var a = ip_min [ 0 ] ; a <= ip_max [ 0 ] ; a ++ ) {
160- ip_parts [ 0 ] = a ;
161- if ( a == ip_max [ 0 ] ) { // Check if we are approaching the end of the subnet
158+ ip_parts [ 3 ] = ip_min [ 3 ] + 1 ;
159+ for ( ip_parts [ 0 ] = ip_min [ 0 ] ; ip_parts [ 0 ] <= ip_max [ 0 ] ; ip_parts [ 0 ] ++ ) {
160+ if ( ip_parts [ 0 ] == ip_max [ 0 ] ) { // Check if we are approaching the end of the subnet
162161 var ae = 1 ;
163162 }
164- for ( var b = ip_min [ 1 ] ; b <= ip_max [ 1 ] ; b ++ ) {
165- ip_parts [ 1 ] = b ;
166- if ( ae == 1 && b == ip_max [ 1 ] ) {
163+ for ( ip_parts [ 1 ] = ip_min [ 1 ] ; ip_parts [ 1 ] <= ip_max [ 1 ] ; ip_parts [ 1 ] ++ ) {
164+ if ( ae == 1 && ip_parts [ 1 ] == ip_max [ 1 ] ) {
167165 var be = 1 ;
168166 }
169- for ( var c = ip_min [ 2 ] ; c <= ip_max [ 2 ] ; c ++ ) {
170- ip_parts [ 2 ] = c ;
171- if ( be == 1 && c == ip_max [ 2 ] ) {
167+ for ( ip_parts [ 2 ] = ip_min [ 2 ] ; ip_parts [ 2 ] <= ip_max [ 2 ] ; ip_parts [ 2 ] ++ ) {
168+ if ( be == 1 && ip_parts [ 2 ] == ip_max [ 2 ] ) {
172169 ip_max [ 3 ] -- ; // Prevent the broadcast address from getting queued
173170 }
174- while ( d <= ip_max [ 3 ] ) {
175- ip_parts [ 3 ] = d ;
171+ while ( ip_parts [ 3 ] <= ip_max [ 3 ] ) {
176172 var tmp_ip = ip_parts [ 0 ] + '.' + ip_parts [ 1 ] + '.' + ip_parts [ 2 ] + '.' + ip_parts [ 3 ] ;
177173 sonar . ip_queue . push ( tmp_ip ) ;
178- d ++ ;
174+ ip_parts [ 3 ] ++ ;
179175 }
180- d = ip_min [ 3 ]
176+ ip_parts [ 3 ] = ip_min [ 3 ] ;
181177 }
182178 }
183179 }
You can’t perform that action at this time.
0 commit comments