Tcl Library Source Code

Check-in [27f9dbf374]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Ticket [659631d1f4]. dns, package 'ip' - Fixed nextNet issue with its count argument. Extended testsuite. Fix by Matthew Jefferson.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 27f9dbf37417d34fd35596bb46c845b2f5be181f
User & Date: andreask 2014-02-04 20:53:54
References
2014-02-04
20:57 Closed ticket [2875035fff]: nextNet's count argument does not function as expected plus 9 other changes artifact: af325e2557 user: aku
20:57 Closed ticket [659631d1f4]: nextNet --> nextNet's count argument does not function as expected plus 6 other changes artifact: 8e78661fad user: aku
Context
2014-02-04
21:16
Followup on [ea88434604]. Restrict to 32bits. check-in: cfd881b6f8 user: aku tags: trunk
20:53
Ticket [659631d1f4]. dns, package 'ip' - Fixed nextNet issue with its count argument. Extended testsuite. Fix by Matthew Jefferson. check-in: 27f9dbf374 user: andreask tags: trunk
20:31
Ticket [2186ff86b7]. dns, package 'ip' - Fixed toInteger wrap-around. Bumped version to 1.2.2. Extended testsuite. check-in: ea88434604 user: andreask tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/dns/ip.test.

242
243
244
245
246
247
248














249
250
251
252
253
254
255
256
257
    8 255.0.0.0       4278190080
    9 255.255.255.255 4294967295
} {
    test ip-12.$i "toInteger $ip" {
        ip::toInteger $ip
    } $e
}















# -------------------------------------------------------------------------

testsuiteCleanup

# Local Variables:
#  mode: tcl
#  indent-tabs-mode: nil
# End:






>
>
>
>
>
>
>
>
>
>
>
>
>
>









242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
    8 255.0.0.0       4278190080
    9 255.255.255.255 4294967295
} {
    test ip-12.$i "toInteger $ip" {
        ip::toInteger $ip
    } $e
}

# -------------------------------------------------------------------------

foreach {i pma e} {
    0 {1.1.1.1 24}   1.1.2.1/0
    1 {1.1.1.1 24 0} 1.1.1.1/0
    2 {1.1.1.1 24 1} 1.1.2.1/0
    3 {1.1.1.1 24 2} 1.1.3.1/0
} {
    test ip-13.$i "nextNet $pma" {
        ip::nativeToPrefix [eval ip::nextNet $pma]
    } $e
}


# -------------------------------------------------------------------------

testsuiteCleanup

# Local Variables:
#  mode: tcl
#  indent-tabs-mode: nil
# End:

Changes to modules/dns/ipMore.tcl.

651
652
653
654
655
656
657
658
659
660

661
662
663
664
665
666
667
	}
    }
    if {![string is integer -strict $prefix]} { 
	set prefix [toInteger $prefix]
    }
    if {![string is integer -strict $mask] || ($mask < 33 && $mask > 0)} {
	set mask [maskToInt $mask]
    } 
    
    set prefix [expr $prefix + ($mask ^ 0xFFffFFff) + $count ]

    return [format "0x%08x" $prefix]
}


##Procedure Header
# Copyright (c) 2004 Cisco Systems, Inc.
#






|
<
<
>







651
652
653
654
655
656
657
658


659
660
661
662
663
664
665
666
	}
    }
    if {![string is integer -strict $prefix]} { 
	set prefix [toInteger $prefix]
    }
    if {![string is integer -strict $mask] || ($mask < 33 && $mask > 0)} {
	set mask [maskToInt $mask]
    }    


    set prefix [expr {$prefix + ((($mask ^ 0xFFffFFff) + 1) * $count) }]
    return [format "0x%08x" $prefix]
}


##Procedure Header
# Copyright (c) 2004 Cisco Systems, Inc.
#