[Pkg-tcltk-commits] r1947 - in tcllib/trunk/debian: . patches
sgolovan at alioth.debian.org
sgolovan at alioth.debian.org
Fri Feb 2 06:21:04 UTC 2018
Author: sgolovan
Date: 2018-02-02 06:21:03 +0000 (Fri, 02 Feb 2018)
New Revision: 1947
Modified:
tcllib/trunk/debian/changelog
tcllib/trunk/debian/control
tcllib/trunk/debian/patches/nettool.patch
Log:
[tcllib]
* Replace the arp and ifconfig calls by parsing /proc/net/arp and calling
ip address show in the nettool module because of the changes in the
ifconfig output.
* Add iproute2 to the dependencies list for nettool and uuid modules.
Modified: tcllib/trunk/debian/changelog
===================================================================
--- tcllib/trunk/debian/changelog 2018-01-30 09:11:14 UTC (rev 1946)
+++ tcllib/trunk/debian/changelog 2018-02-02 06:21:03 UTC (rev 1947)
@@ -1,8 +1,11 @@
-tcllib (1.18-dfsg-4) UNRELEASED; urgency=medium
+tcllib (1.18-dfsg-4) unstable; urgency=medium
- * NOT RELEASED YET
+ * Replace the arp and ifconfig calls by parsing /proc/net/arp and calling
+ ip address show in the nettool module because of the changes in the
+ ifconfig output.
+ * Add iproute2 to the dependencies list for nettool and uuid modules.
- -- Sergei Golovan <sgolovan at debian.org> Tue, 26 Apr 2016 17:46:36 +0300
+ -- Sergei Golovan <sgolovan at debian.org> Fri, 02 Feb 2018 09:08:59 +0300
tcllib (1.18-dfsg-3) unstable; urgency=medium
Modified: tcllib/trunk/debian/control
===================================================================
--- tcllib/trunk/debian/control 2018-01-30 09:11:14 UTC (rev 1946)
+++ tcllib/trunk/debian/control 2018-02-02 06:21:03 UTC (rev 1947)
@@ -12,8 +12,8 @@
Section: interpreters
Priority: optional
Architecture: all
-Depends: ${tclsh:Depends}, ${misc:Depends}
-Suggests: net-tools, tcllib-critcl
+Depends: ${tclsh:Depends}, iproute2, ${misc:Depends}
+Suggests: tcllib-critcl
Description: Standard Tcl Library
Tcllib, the standard Tcl library, is a collection of common utility
functions and modules all written in high-level Tcl.
Modified: tcllib/trunk/debian/patches/nettool.patch
===================================================================
--- tcllib/trunk/debian/patches/nettool.patch 2018-01-30 09:11:14 UTC (rev 1946)
+++ tcllib/trunk/debian/patches/nettool.patch 2018-02-02 06:21:03 UTC (rev 1947)
@@ -1,29 +1,141 @@
Author: Sergei Golovan
-Description: Patch hardcodes arp and ifconfig paths for the case when /sbin
- or /usr/sbin isn't in the user's PATH.
-Last-Modified: Tue, 26 Apr 2016 17:24:52 +0300
+Description: Patch replaces the arp and ifconfig calls by direct parsing of
+ /proc/net/arp and ip address call respectively.
+Last-Modified: Fri, 02 Feb 2018 09:04:55 +0300
Debian-Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=822293
Bug: https://core.tcl.tk/tcllib/tktview?name=d879576438
+Bug: https://core.tcl.tk/tcllib/tktview?name=9a21637273
---- a/modules/nettool/platform_unix.tcl
-+++ b/modules/nettool/platform_unix.tcl
-@@ -11,7 +11,7 @@
+--- a/modules/nettool/platform_unix_linux.tcl
++++ b/modules/nettool/platform_unix_linux.tcl
+@@ -1,6 +1,24 @@
+ ::namespace eval ::nettool {}
+
###
- proc ::nettool::arp_table {} {
++# topic: 825cd25953c2cc896a96006b7f454e00
++# title: Return pairings of MAC numbers to IP addresses on the local network
++# description: Under Linux, we read the arp table from /proc/net/arp
++# ###
++proc ::nettool::arp_table {} {
++ set result {}
++ set fd [open /proc/net/arp]
++ set dat [read $fd]
++ close $fd
++ foreach line [lrange [split $dat \n] 1 end-1] {
++ set ip [lindex $line 0]
++ set macid [lindex $line 3]
++ lappend result $macid $ip
++ }
++ return $result
++}
++
++###
+ # topic: 92ebbfa155883ad41c37d3f843392be4
+ # title: Return list of broadcast addresses for local networks
+ ###
+@@ -8,7 +26,7 @@
set result {}
-- set dat [exec arp -a]
-+ set dat [exec /usr/sbin/arp -a]
- foreach line [split $dat \n] {
- set host [lindex $line 0]
- set ip [lindex $line 1]
---- a/modules/nettool/platform_unix_linux.tcl
-+++ b/modules/nettool/platform_unix_linux.tcl
-@@ -92,7 +92,7 @@
+ lappend result 127.0.0.1
+ foreach {iface info} [dump] {
+- if {[dict exists $info ipv4 Bcast:]} {
++ if {[dict exists $info ipv4 brd]} {
+ lappend result [dict get $info ipv4 Bcast:]
+ }
+ }
+@@ -92,38 +110,45 @@
# description: Dump interfaces
###
proc ::nettool::dump {} {
- set data [exec ifconfig]
-+ set data [exec /sbin/ifconfig]
++ set data [exec ip address show]
set iface {}
set result {}
foreach line [split $data \n] {
+ if {[string index $line 0] in {" " "\t"} } {
+ # Indented line appends the prior iface
+- switch [lindex $line 0] {
++ switch -glob -- [lindex $line 0] {
+ inet {
+- foreach tuple [lrange $line 1 end] {
+- set idx [string first : $tuple]
+- set field [string trim [string range $tuple 0 $idx]]
+- set value [string trim [string range $tuple $idx+1 end]]
+- dict set result $iface ipv4 [string trim $field] [string trim $value]
++ lassign [split [lindex $line 1]/32 /] addr prefix
++ set ipv4dict [dict create addr: $addr prefix: $prefix]
++ foreach {field value} [lrange $line 2 end] {
++ dict set ipv4dict [string trim $field] [string trim $value]
++ }
++ if {![dict exists $result $iface ipv4 scope] || \
++ [dict get $result $iface ipv4 scope] ne "global"} {
++ dict set result $iface ipv4 $ipv4dict
+ }
+ }
+ inet6 {
+- dict set result $iface ipv6 addr: [lindex $line 2]
+- foreach tuple [lrange $line 3 end] {
+- set idx [string first : $tuple]
+- set field [string trim [string range $tuple 0 $idx]]
+- set value [string trim [string range $tuple $idx+1 end]]
+- dict set result $iface ipv6 [string trim $field] [string trim $value]
++ lassign [split [lindex $line 1]/128 /] addr prefix
++ set ipv6dict [dict create addr: $addr prefix: $prefix]
++ foreach {field value} [lrange $line 2 end] {
++ dict set ipv6dict [string trim $field] [string trim $value]
++ }
++ if {![dict exists $result $iface ipv6 scope] || \
++ [dict get $result $iface ipv6 scope] ne "global"} {
++ dict set result $iface ipv6 $ipv6dict
+ }
+ }
++ link/* {
++ set ether [lindex $line 1]
++ if {$ether ne ""} {
++ dict set result $iface ether: $ether
++ }
++ }
+ }
+ } else {
+ # Non-intended line - new iface
+- set iface [lindex $line 0]
+- set idx [lsearch $line HWaddr]
+- if {$idx >= 0 } {
+- dict set result $iface ether: [lindex $line $idx+1]
+- }
++ set iface [string trim [lindex $line 1] :]
+ }
+ }
+ return $result
+@@ -140,8 +165,7 @@
+ lappend result [dict get $info ipv4 addr:]
+ }
+ }
+- ldelete result 127.0.0.1
+- return $result
++ return [lsearch -all -inline -not -exact $result 127.0.0.1]
+ }
+
+ ###
+@@ -155,7 +179,7 @@
+ lappend result [dict get $info ether:]
+ }
+ }
+- return $result
++ return [lsearch -all -inline -not -exact $result 00:00:00:00:00:00]
+ }
+
+ ###
+@@ -164,10 +188,10 @@
+ proc ::nettool::network_list {} {
+ foreach {iface info} [dump] {
+ if {![dict exists $info ipv4 addr:]} continue
+- if {![dict exists $info ipv4 Mask:]} continue
+- #set mask [::ip::maskToInt $netmask]
++ if {![dict exists $info ipv4 prefix:]} continue
+ set addr [dict get $info ipv4 addr:]
+- set mask [dict get $info ipv4 Mask:]
++ set prefix [dict get $info ipv4 prefix:]
++ set mask [::ip::toInteger [::ip::lengthToMask $prefix]]
+ set addri [::ip::toInteger $addr]
+ lappend result [ip::nativeToPrefix [list [expr {$addri & $mask}] $mask] -ipv4]
+ }
More information about the Pkg-tcltk-commits
mailing list