]> git.entuzijast.net Git - imunes.git/commitdiff
First-cut IPv6 support in GUI
authormarko <marko>
Sun, 10 Jul 2005 22:45:31 +0000 (22:45 +0000)
committermarko <marko>
Sun, 10 Jul 2005 22:45:31 +0000 (22:45 +0000)
Bug found by:
Submitted by:
Requested by:
Reviewed by:
Approved by:
Obtained from:

editor.tcl
host.tcl
nodecfg.tcl
pc.tcl
quagga.tcl
static.tcl
xorp.tcl

index d3e024360b018102bc01edc3a7440a7809be29c0..9fbda2dad297e9007e24bc07f8c100b1aa4e465a 100755 (executable)
@@ -446,13 +446,13 @@ proc chooseIfName { lnode1 lnode2 } {
 }
 
 
-proc findFreeIPnet { mask } {
+proc findFreeIPv4net { mask } {
     global nodes
 
     set ipnets {}
     foreach node $nodes {
        foreach ifc [ifcList $node] {
-           set ipnet [lrange [split [getIfcIPaddr $node $ifc] .] 0 2]
+           set ipnet [lrange [split [getIfcIPv4addr $node $ifc] .] 0 2]
            if {[lsearch $ipnets $ipnet] == -1} {
                lappend ipnets $ipnet
            }
@@ -469,6 +469,27 @@ proc findFreeIPnet { mask } {
 }
 
 
+proc findFreeIPv6net { mask } {
+    global nodes
+
+    set ipnets {}
+    foreach node $nodes {
+       foreach ifc [ifcList $node] {
+           set ipnet [lrange [split [getIfcIPv6addr $node $ifc] :] 0 1]
+           if {[lsearch $ipnets $ipnet] == -1} {
+               lappend ipnets $ipnet
+           }
+       }
+    }
+    for { set i 0 } { $i <= 9999 } { incr i } {
+       if {[lsearch $ipnets "fefe $i"] == -1} {
+           set ipnet "fefe:$i"
+           return $ipnet
+       }
+    }
+}
+
+
 proc listLANnodes { l2node l2peers } {
     lappend l2peers $l2node
     foreach ifc [ifcList $l2node] {
@@ -484,14 +505,14 @@ proc listLANnodes { l2node l2peers } {
 }
 
 
-proc newLANIP { l3node bridge } {
+proc newLANIPv4 { l3node bridge } {
     set peer_ipaddrs {}
     set l2nodes [listLANnodes $bridge {}]
     foreach l2node $l2nodes {
        foreach ifc [ifcList $l2node] {
            set peer [peerByIfc $l2node $ifc]
            set peer_if [ifcByPeer $peer $l2node]
-           set peer_ipaddr [getIfcIPaddr $peer $peer_if]
+           set peer_ipaddr [getIfcIPv4addr $peer $peer_if]
            if { $peer_ipaddr != "" } {
                lappend peer_ipaddrs [lindex [split $peer_ipaddr /] 0]
            }
@@ -518,7 +539,46 @@ proc newLANIP { l3node bridge } {
        }
        return "$ipaddr/24"
     } else {
-       return "[findFreeIPnet 24].$targetbyte/24"
+       return "[findFreeIPv4net 24].$targetbyte/24"
+    }
+}
+
+
+proc newLANIPv6 { l3node bridge } {
+    set peer_ipaddrs {}
+    set l2nodes [listLANnodes $bridge {}]
+    foreach l2node $l2nodes {
+       foreach ifc [ifcList $l2node] {
+           set peer [peerByIfc $l2node $ifc]
+           set peer_if [ifcByPeer $peer $l2node]
+           set peer_ipaddr [getIfcIPv6addr $peer $peer_if]
+           if { $peer_ipaddr != "" } {
+               lappend peer_ipaddrs [lindex [split $peer_ipaddr /] 0]
+           }
+       }
+    }
+    switch -exact -- [nodeType $l3node] {
+       router {
+           set targetbyte 1
+       }
+       host {
+           set targetbyte 10
+       }
+       pc {
+           set targetbyte 20
+       }
+    }
+    if { $peer_ipaddrs != "" } {
+       set ipnums [split [lindex $peer_ipaddrs 0] :]
+       set net "[lindex $ipnums 0]:[lindex $ipnums 1]"
+       set ipaddr $net\::$targetbyte
+       while { [lsearch $peer_ipaddrs $ipaddr] >= 0 } {
+           incr targetbyte
+           set ipaddr $net\::$targetbyte
+       }
+       return "$ipaddr/64"
+    } else {
+       return "[findFreeIPv6net 64]::$targetbyte/64"
     }
 }
 
@@ -527,7 +587,7 @@ proc findLANdgIP { bridge } {
     foreach ifc [ifcList $bridge] {
        set peer [peerByIfc $bridge $ifc]
        set peer_if [ifcByPeer $peer $bridge]
-       set peer_ipaddr [getIfcIPaddr $peer $peer_if]
+       set peer_ipaddr [getIfcIPv4addr $peer $peer_if]
        if { [nodeType $peer] == "router" } {
            return [lindex [split $peer_ipaddr /] 0]
        }
@@ -543,7 +603,7 @@ proc updateLANdg { bridge } {
     foreach ifc [ifcList $bridge] {
        set peer [peerByIfc $bridge $ifc]
        if { [nodeType $peer] == "pc" || [nodeType $peer] == "host" } {
-           setStatIProutes $peer [list "0.0.0.0/0 $gw"]
+           setStatIPv4routes $peer [list "0.0.0.0/0 $gw"]
        }
     }
     return
@@ -603,7 +663,8 @@ proc updateIfcLabel { lnode1 lnode2 } {
 
     set link [lindex [.c gettags "link && $lnode1 && $lnode2"] 1]
     set ifc [ifcByPeer $lnode1 $lnode2]
-    set ifipaddr [getIfcIPaddr $lnode1 $ifc]
+    set ifipv4addr [getIfcIPv4addr $lnode1 $ifc]
+    set ifipv6addr [getIfcIPv6addr $lnode1 $ifc]
     if { $ifc == 0 } {
        set ifc ""
     }
@@ -615,8 +676,11 @@ proc updateIfcLabel { lnode1 lnode2 } {
     if { $showIfNames } {
        set labelstr "$labelstr$ifc\r"
     }
-    if { $showIfIPaddrs && $ifipaddr != "" } {
-       set labelstr "$labelstr$ifipaddr\r"
+    if { $showIfIPaddrs && $ifipv4addr != "" } {
+       set labelstr "$labelstr$ifipv4addr\r"
+    }
+    if { $showIfIPaddrs && $ifipv6addr != "" } {
+       set labelstr "$labelstr$ifipv6addr\r"
     }
     set labelstr \
        [string range $labelstr 0 [expr [string length $labelstr] - 2]]
@@ -841,7 +905,13 @@ proc button1 { c x y button} {
                        ! \
                        "router rip" \
                        " redistribute static" \
+                       " redistribute connected" \
                        " network 0.0.0.0/0" \
+                       ! \
+                       "router ripng" \
+                       " redistribute static" \
+                       " redistribute connected" \
+                       " network ::/0" \
                        ! ]
            } elseif {$activetool == "rj45"} {
                set nconfig [list \
@@ -1028,21 +1098,24 @@ proc button1-release { c x y } {
                set link [newId link]
                global $link
 
-               set ipnet [findFreeIPnet 24]
+               set ipv4net [findFreeIPv4net 24]
+               set ipv6net [findFreeIPv6net 64]
                set lannode ""
 
                set ifname1 [newIfc [chooseIfName $lnode1 $lnode2] $lnode1]
                lappend $lnode1 "interface-peer {$ifname1 $lnode2}"
                if { [lsearch {lanswitch hub rj45} [nodeType $lnode1]] < 0 && \
                    [lsearch {lanswitch hub} [nodeType $lnode2]] >= 0 } {
-                   setIfcIPaddr $lnode1 $ifname1 [newLANIP $lnode1 $lnode2]
+                   setIfcIPv4addr $lnode1 $ifname1 [newLANIPv4 $lnode1 $lnode2]
+                   setIfcIPv6addr $lnode1 $ifname1 [newLANIPv6 $lnode1 $lnode2]
                    set lannode $lnode2
                } elseif { [lsearch {hub frswitch lanswitch rj45} \
                  [nodeType $lnode1]] < 0 } {
-                   setIfcIPaddr $lnode1 $ifname1 $ipnet.1/24
+                   setIfcIPv4addr $lnode1 $ifname1 $ipv4net.1/24
+                   setIfcIPv6addr $lnode1 $ifname1 $ipv6net\::1/64
                    if { [nodeType $lnode1] == "pc" || \
                        [nodeType $lnode1] == "host" } {
-                       setStatIProutes $lnode1 [list "0.0.0.0/0 $ipnet.2"]
+                       setStatIPv4routes $lnode1 [list "0.0.0.0/0 $ipv4net.2"]
                    }
                }
 
@@ -1050,14 +1123,16 @@ proc button1-release { c x y } {
                lappend $lnode2 "interface-peer {$ifname2 $lnode1}"
                if { [lsearch {lanswitch hub rj45} [nodeType $lnode2]] < 0 && \
                    [lsearch {lanswitch hub} [nodeType $lnode1]] >= 0 } {
-                   setIfcIPaddr $lnode2 $ifname2 [newLANIP $lnode2 $lnode1]
+                   setIfcIPv4addr $lnode2 $ifname2 [newLANIPv4 $lnode2 $lnode1]
+                   setIfcIPv6addr $lnode2 $ifname2 [newLANIPv6 $lnode2 $lnode1]
                    set lannode $lnode1
                } elseif { [lsearch {hub frswitch lanswitch rj45} \
                  [nodeType $lnode2]] < 0 } {
-                   setIfcIPaddr $lnode2 $ifname2 $ipnet.2/24
+                   setIfcIPv4addr $lnode2 $ifname2 $ipv4net.2/24
+                   setIfcIPv6addr $lnode2 $ifname2 $ipv6net\::2/64
                    if { [nodeType $lnode2] == "pc" || \
                        [nodeType $lnode2] == "host" } {
-                       setStatIProutes $lnode2 [list "0.0.0.0/0 $ipnet.1"]
+                       setStatIPv4routes $lnode2 [list "0.0.0.0/0 $ipv4net.1"]
                    }
                }
 
@@ -1183,7 +1258,7 @@ proc nodeEnter { c } {
     }
     if { $type != "rj45" } {
        foreach ifc [ifcList $node] {
-           set line "$line $ifc:[getIfcIPaddr $node $ifc]"
+           set line "$line $ifc:[getIfcIPv4addr $node $ifc]"
        }
     }
     .bottom.textbox config -text "$line"
@@ -1235,7 +1310,7 @@ proc checkIntRange { str low high } {
 }
 
 
-proc checkIPAddr { str } {
+proc checkIPv4Addr { str } {
     set n 0
     while { $n < 4 } {
        if { $n < 3 } {
@@ -1263,8 +1338,8 @@ proc checkIPAddr { str } {
 }
 
 
-proc checkIPNet { str } {
-    if { ![checkIPAddr [lindex [split $str /] 0]]} {
+proc checkIPv4Net { str } {
+    if { ![checkIPv4Addr [lindex [split $str /] 0]]} {
        return 0
     }
     set net [lindex [split $str /] 1]
@@ -1389,8 +1464,7 @@ proc popupConfigDialog { c } {
                    frame $wi.if$ifc.tab -width 10
                    frame $wi.if$ifc.cfg
 
-                   if { [nodeType [peerByIfc $target $ifc]] != "rj45" && \
-                       [nodeType $target] != "rj45" } {
+                   if { 1 } {
                        #
                        # Queue config
                        #
@@ -1422,44 +1496,55 @@ proc popupConfigDialog { c } {
 
                    if {[lsearch {router pc host} $type] >= 0} {
                        #
-                       # IP address & MTU
+                       # IPv4 address & MTU
                        #
-                       frame $wi.if$ifc.cfg.ip
-                       label $wi.if$ifc.cfg.ip.addrl -text "IP address" \
+                       frame $wi.if$ifc.cfg.ipv4
+                       label $wi.if$ifc.cfg.ipv4.addrl -text "IPv4 address" \
                                -anchor w
-                       entry $wi.if$ifc.cfg.ip.addrv -bg white -width 16 \
+                       entry $wi.if$ifc.cfg.ipv4.addrv -bg white -width 16 \
                            -validate focus -invcmd "focusAndFlash %W"
-                       $wi.if$ifc.cfg.ip.addrv insert 0 \
-                           [getIfcIPaddr $target $ifc]
-                       $wi.if$ifc.cfg.ip.addrv configure \
-                           -vcmd {checkIPNet %P}
-                       if { $model == "xorp" && $oper_mode != "edit" } {
-                           $wi.if$ifc.cfg.ip.addrv configure \
-                               -state readonly
-                       }
-                       label $wi.if$ifc.cfg.ip.mtul -text "MTU" \
+                       $wi.if$ifc.cfg.ipv4.addrv insert 0 \
+                           [getIfcIPv4addr $target $ifc]
+                       $wi.if$ifc.cfg.ipv4.addrv configure \
+                           -vcmd {checkIPv4Net %P}
+                       label $wi.if$ifc.cfg.ipv4.mtul -text "MTU" \
                            -anchor e -width 5
-                       spinbox $wi.if$ifc.cfg.ip.mtuv -bg white -width 4 \
+                       spinbox $wi.if$ifc.cfg.ipv4.mtuv -bg white -width 4 \
                            -validate focus -invcmd "focusAndFlash %W"
-                       $wi.if$ifc.cfg.ip.mtuv insert 0 \
+                       $wi.if$ifc.cfg.ipv4.mtuv insert 0 \
                            [getIfcMTU $target $ifc]
                        if {![string first eth $ifc]} {
-                           $wi.if$ifc.cfg.ip.mtuv configure \
+                           $wi.if$ifc.cfg.ipv4.mtuv configure \
                                -from 256 -to 1500 -increment 2 \
                                -vcmd {checkIntRange %P 256 1500}
                        } else {
-                           $wi.if$ifc.cfg.ip.mtuv configure \
+                           $wi.if$ifc.cfg.ipv4.mtuv configure \
                                -from 256 -to 2044 -increment 2 \
                                -vcmd {checkIntRange %P 256 2044}
                        }
-                       if { $model == "xorp" && $oper_mode != "edit" } {
-                           $wi.if$ifc.cfg.ip.mtuv configure \
-                               -state readonly
-                       }
-                       pack $wi.if$ifc.cfg.ip.addrl \
-                           $wi.if$ifc.cfg.ip.addrv $wi.if$ifc.cfg.ip.mtul \
-                           $wi.if$ifc.cfg.ip.mtuv -side left
-                       pack $wi.if$ifc.cfg.ip -side top -anchor w
+                       pack $wi.if$ifc.cfg.ipv4.addrl \
+                           $wi.if$ifc.cfg.ipv4.addrv \
+                           $wi.if$ifc.cfg.ipv4.mtul \
+                           $wi.if$ifc.cfg.ipv4.mtuv -side left
+                       pack $wi.if$ifc.cfg.ipv4 -side top -anchor w
+
+                       #
+                       # IPv6 address
+                       #
+                       frame $wi.if$ifc.cfg.ipv6
+                       label $wi.if$ifc.cfg.ipv6.addrl -text "IPv6 address" \
+                               -anchor w
+                       entry $wi.if$ifc.cfg.ipv6.addrv -bg white -width 30 \
+                           -validate focus -invcmd "focusAndFlash %W"
+                       $wi.if$ifc.cfg.ipv6.addrv insert 0 \
+                           [getIfcIPv6addr $target $ifc]
+if { 0 } {
+                       $wi.if$ifc.cfg.ipv6.addrv configure \
+                           -vcmd {checkIPv4Net %P}
+}
+                       pack $wi.if$ifc.cfg.ipv6.addrl \
+                           $wi.if$ifc.cfg.ipv6.addrv -side left
+                       pack $wi.if$ifc.cfg.ipv6 -side top -anchor w
                    }
                    pack $wi.if$ifc.tab $wi.if$ifc.cfg -side left
                    pack $wi.if$ifc -side top -anchor w -fill both
@@ -1470,7 +1555,7 @@ proc popupConfigDialog { c } {
                #
                # Static IP routes
                #
-               set routes [getStatIProutes $target]
+               set routes [getStatIPv4routes $target]
                labelframe $wi.statrt -padx 4 -pady 4
                label $wi.statrt.label -text "Static IP routes:"
                pack $wi.statrt.label -side top -anchor w
@@ -1777,17 +1862,26 @@ proc popupConfigApply { wi object_type target close phase } {
                    }
 
                    #
-                   # IP address & MTU
+                   # IPv4 / IPv6 address & MTU
                    #
-                   set ipaddr [$wi.if$ifc.cfg.ip.addrv get]
-                   set oldipaddr [getIfcIPaddr $target $ifc]
+                   set ipaddr [$wi.if$ifc.cfg.ipv4.addrv get]
+                   set oldipaddr [getIfcIPv4addr $target $ifc]
                    if { $ipaddr != $oldipaddr } {
-                       setIfcIPaddr $target $ifc $ipaddr
+                       setIfcIPv4addr $target $ifc $ipaddr
                        updateIfcLabel $target [peerByIfc $target $ifc]
                        set changed 1
                        set ifconfchanged 1
                    }
-                   set mtu [$wi.if$ifc.cfg.ip.mtuv get]
+                   set ipaddr [$wi.if$ifc.cfg.ipv6.addrv get]
+                   set oldipaddr [getIfcIPv6addr $target $ifc]
+                   if { $ipaddr != $oldipaddr } {
+                       setIfcIPv6addr $target $ifc $ipaddr
+                       updateIfcLabel $target [peerByIfc $target $ifc]
+                       set changed 1
+                       set ifconfchanged 1
+                   }
+
+                   set mtu [$wi.if$ifc.cfg.ipv4.mtuv get]
                    set oldmtu [getIfcMTU $target $ifc]
                    if { $mtu != $oldmtu } {
                        setIfcMTU $target $ifc $mtu
@@ -1796,7 +1890,7 @@ proc popupConfigApply { wi object_type target close phase } {
 
                }
 
-               set oldstatrtes [getStatIProutes $target]
+               set oldstatrtes [getStatIPv4routes $target]
                set newstatrtes {}
                set i 1
                while { 1 } {
@@ -1810,7 +1904,7 @@ proc popupConfigApply { wi object_type target close phase } {
                }
                if { [lsort $oldstatrtes] != [lsort $newstatrtes] || \
                  $ifconfchanged == 1} {
-                   setStatIProutes $target $newstatrtes
+                   setStatIPv4routes $target $newstatrtes
                    set changed 1
                }
 
index ec52116209e816a7c0a8581e04ecd70b1851a650..774971b3d37146e3d45c4c25a1af01bdf92e1665 100755 (executable)
--- a/host.tcl
+++ b/host.tcl
@@ -40,11 +40,12 @@ proc host.cfggen { node } {
     set cfg {}
 
     foreach ifc [ifcList $node] {
-       lappend cfg "ifconfig $ifc inet [getIfcIPaddr $node $ifc]"
+       lappend cfg "ifconfig $ifc inet [getIfcIPv4addr $node $ifc]"
+       lappend cfg "ifconfig $ifc inet6 [getIfcIPv6addr $node $ifc]"
     }
     lappend cfg ""
 
-    foreach statrte [getStatIProutes $node] {
+    foreach statrte [getStatIPv4routes $node] {
        lappend cfg "route add $statrte"
     }
 
index 16619e2c163731dbf3b4b8faab9efd908c3ce2f9..40590377f8884614d83398e609c0d4873276c16d 100755 (executable)
 #     router
 #     host
 #     pc
-#     lan-switch
+#     lanswitch
+#     hub
 #     rj45
 #
 # The following node types are to be implemented in the future:
 #
-#     fr-switch
+#     frswitch
 #     pseudo
 #     text
 #     image
 # setIfcMTU { node_id ifc mtu }
 #      Sets the new MTU. Zero MTU value denotes the default MTU.
 #
-# getIfcIPaddr { node_id ifc }
-#      Returns a list of all IP addresses assigned to an interface.
+# getIfcIPv4addr { node_id ifc }
+#      Returns a list of all IPv4 addresses assigned to an interface.
 #
-# setIfcIPaddr { node_id ifc addr }
-#      Sets a new IP address(es) on an interface. The correctness of the
+# setIfcIPv4addr { node_id ifc addr }
+#      Sets a new IPv4 address(es) on an interface. The correctness of the
 #      IP address format is not checked / enforced.
 #
-# getStatIProutes { node_id }
-#      Returns a list of all static IP routes as a list of
-#      {destination gateway} pairs.
+# getIfcIPv6addr { node_id ifc }
+#      Returns a list of all IPv6 addresses assigned to an interface.
 #
-# setStatIProutes { node_id route_list }
+# setIfcIPv6addr { node_id ifc addr }
+#      Sets a new IPv6 address(es) on an interface. The correctness of the
+#      IP address format is not checked / enforced.
+#
+# getStatIPv4routes { node_id }
+#      Returns a list of all static IPv4 routes as a list of
+#      {destination gateway {metric}} pairs.
+#
+# setStatIPv4routes { node_id route_list }
+#      Replace all current static route entries with a new one, in form of
+#      a list, as described above.
+#
+# getStatIPv6routes { node_id }
+#      Returns a list of all static IPv6 routes as a list of
+#      {destination gateway {metric}} pairs.
+#
+# setStatIPv6routes { node_id route_list }
 #      Replace all current static route entries with a new one, in form of
 #      a list, as described above.
 #
@@ -480,7 +496,7 @@ proc setIfcMTU { node ifc mtu } {
 }
 
 
-proc getIfcIPaddr { node ifc } {
+proc getIfcIPv4addr { node ifc } {
     set addrlist {}
     foreach line [netconfFetchSection $node "interface $ifc"] {
        if { [lrange $line 0 1] == "ip address" } {
@@ -491,7 +507,7 @@ proc getIfcIPaddr { node ifc } {
 }
 
 
-proc setIfcIPaddr { node ifc addr } {
+proc setIfcIPv4addr { node ifc addr } {
     set ifcfg [list "interface $ifc"]
     foreach line [netconfFetchSection $node "interface $ifc"] {
         if { [lrange $line 0 1] != "ip address" } {
@@ -504,20 +520,44 @@ proc setIfcIPaddr { node ifc addr } {
 }
 
 
-proc getStatIProutes { node } {
+proc getIfcIPv6addr { node ifc } {
+    set addrlist {}
+    foreach line [netconfFetchSection $node "interface $ifc"] {
+       if { [lrange $line 0 1] == "ipv6 address" } {
+           lappend addrlist [lindex $line 2]
+       }
+    }
+    return $addrlist
+}
+
+
+proc setIfcIPv6addr { node ifc addr } {
+    set ifcfg [list "interface $ifc"]
+    foreach line [netconfFetchSection $node "interface $ifc"] {
+        if { [lrange $line 0 1] != "ipv6 address" } {
+            lappend ifcfg $line
+        }
+    }
+    lappend ifcfg " ipv6 address $addr"
+    netconfInsertSection $node $ifcfg
+    return
+}
+
+
+proc getStatIPv4routes { node } {
     global $node
 
     set routes {}
     set netconf [lindex [lsearch -inline [set $node] "network-config *"] 1]
     foreach entry [lsearch -all -inline $netconf "ip route *"] {
-       lappend routes [lrange $entry 2 3]
+       lappend routes [lrange $entry 2 end]
     }
     return $routes
 }
 
 
-proc setStatIProutes { node routes } {
-    netconfClearSection $node "ip route [lindex [getStatIProutes $node] 0]"
+proc setStatIPv4routes { node routes } {
+    netconfClearSection $node "ip route [lindex [getStatIPv4routes $node] 0]"
     set section {}
     foreach route $routes {
        lappend section "ip route $route"
@@ -527,6 +567,29 @@ proc setStatIProutes { node routes } {
 }
 
 
+proc getStatIPv6routes { node } {
+    global $node
+
+    set routes {}
+    set netconf [lindex [lsearch -inline [set $node] "network-config *"] 1]
+    foreach entry [lsearch -all -inline $netconf "ipv6 route *"] {
+       lappend routes [lrange $entry 2 end]
+    }
+    return $routes
+}
+
+
+proc setStatIPv6routes { node routes } {
+    netconfClearSection $node "ipv6 route [lindex [getStatIPv6routes $node] 0]"
+    set section {}
+    foreach route $routes {
+       lappend section "ipv6 route $route"
+    }
+    netconfInsertSection $node $section
+    return
+}
+
+
 proc getNodeName { node } {
     global $node
 
diff --git a/pc.tcl b/pc.tcl
index 840f95a159c25a041df7eed8c26b1db0baa23ffc..3c76ef6e1d5a0c319db1d5a83d6dd20f7258574a 100755 (executable)
--- a/pc.tcl
+++ b/pc.tcl
@@ -40,11 +40,12 @@ proc pc.cfggen { node } {
     set cfg {}
 
     foreach ifc [ifcList $node] {
-       lappend cfg "ifconfig $ifc inet [getIfcIPaddr $node $ifc]"
+       lappend cfg "ifconfig $ifc inet [getIfcIPv4addr $node $ifc]"
+       lappend cfg "ifconfig $ifc inet6 [getIfcIPv6addr $node $ifc]"
     }
     lappend cfg ""
 
-    foreach statrte [getStatIProutes $node] {
+    foreach statrte [getStatIPv4routes $node] {
        lappend cfg "route add $statrte"
     }
 
index 84a1abaf3e445e49b09f5e153221c8ada8543662..02a6ec8d294edb3e99bbbb68eb755eadfce7255f 100755 (executable)
@@ -41,7 +41,8 @@ proc router.quagga.cfggen { node } {
 
     foreach ifc [ifcList $node] {
        lappend cfg "interface $ifc"
-       lappend cfg " ip address [getIfcIPaddr $node $ifc]"
+       lappend cfg " ip address [getIfcIPv4addr $node $ifc]"
+       lappend cfg " ipv6 address [getIfcIPv6addr $node $ifc]"
        if { [getIfcOperState $node $ifc] == "down" } {
            lappend cfg " shutdown"
        }
@@ -49,7 +50,7 @@ proc router.quagga.cfggen { node } {
 #exec vimage $node ifconfig $ifc [getIfcOperState $node $ifc] # XXX!!!
     }
 
-    foreach proto { rip ospf bgp } {
+    foreach proto { rip ripng ospf bgp } {
        set protocfg [netconfFetchSection $node "router $proto"]
        if { $protocfg != "" } {
            lappend cfg "router $proto"
@@ -59,7 +60,7 @@ proc router.quagga.cfggen { node } {
        }
     }
 
-    foreach statrte [getStatIProutes $node] {
+    foreach statrte [getStatIPv4routes $node] {
        lappend cfg "ip route $statrte"
     }
 
index 19c997645bc88e2d9b7f8481d6935af477bb8564..588499580cd30906bc473f6cda98e29c4bf8eca5 100755 (executable)
@@ -40,11 +40,11 @@ proc router.static.cfggen { node } {
     set cfg {}
 
     foreach ifc [ifcList $node] {
-       lappend cfg "ifconfig $ifc inet [getIfcIPaddr $node $ifc]"
+       lappend cfg "ifconfig $ifc inet [getIfcIPv4addr $node $ifc]"
     }
     lappend cfg ""
 
-    foreach statrte [getStatIProutes $node] {
+    foreach statrte [getStatIPv4routes $node] {
        lappend cfg "route add $statrte"
     }
 
index fb8c5eb74706834c0eaf56923c25cc85ae9255c7..085bf13df5038129fde0e5c0676f832275a5d242 100755 (executable)
--- a/xorp.tcl
+++ b/xorp.tcl
@@ -41,12 +41,17 @@ proc router.xorp.cfggen { node } {
 
     lappend cfg "interfaces {"
     foreach ifc [ifcList $node] {
-       set ipaddr "[lindex [split [getIfcIPaddr $node $ifc] /] 0]"
-       set ipmask "[lindex [split [getIfcIPaddr $node $ifc] /] 1]"
+       set ipv4addr "[lindex [split [getIfcIPv4addr $node $ifc] /] 0]"
+       set ipv4mask "[lindex [split [getIfcIPv4addr $node $ifc] /] 1]"
+       set ipv6addr "[lindex [split [getIfcIPv6addr $node $ifc] /] 0]"
+       set ipv6mask "[lindex [split [getIfcIPv6addr $node $ifc] /] 1]"
        lappend cfg "    interface $ifc {"
        lappend cfg "      vif $ifc {"
-       lappend cfg "          address $ipaddr {"
-       lappend cfg "              prefix-length: $ipmask"
+       lappend cfg "          address $ipv4addr {"
+       lappend cfg "              prefix-length: $ipv4mask"
+       lappend cfg "          }"
+       lappend cfg "          address $ipv6addr {"
+       lappend cfg "              prefix-length: $ipv6mask"
        lappend cfg "          }"
        lappend cfg "      }"
        lappend cfg "    }"
@@ -58,7 +63,7 @@ proc router.xorp.cfggen { node } {
     lappend cfg "}"
     lappend cfg ""
 
-    set statrtes [getStatIProutes $node]
+    set statrtes [getStatIPv4routes $node]
     if { $statrtes != "" } {
        lappend cfg "protocols {"
        lappend cfg "    static {"
@@ -84,13 +89,11 @@ proc router.xorp.cfggen { node } {
        lappend cfg "   }"
        lappend cfg ""
        foreach ifc [ifcList $node] {
-           set ipaddr "[lindex [split [getIfcIPaddr $node $ifc] /] 0]"
-           set ipmask "[lindex [split [getIfcIPaddr $node $ifc] /] 1]"
+           set ipaddr "[lindex [split [getIfcIPv4addr $node $ifc] /] 0]"
+           set ipmask "[lindex [split [getIfcIPv4addr $node $ifc] /] 1]"
            lappend cfg "       interface $ifc {"
            lappend cfg "           vif $ifc {"
            lappend cfg "               address $ipaddr {"
-           lappend cfg "                   advertise-default-route: true"
-           lappend cfg "                   accept-default-route: true"
            lappend cfg "               }"
            lappend cfg "           }"
            lappend cfg "       }"