dhcpv6
This commit is contained in:
parent
90e1aaa20d
commit
00a630fd34
32
src/main.cr
32
src/main.cr
@ -183,6 +183,13 @@ class NetworkCommands
|
||||
raise "(udhcpc) dhcp failed on #{ifname}"
|
||||
end
|
||||
end
|
||||
|
||||
def self.dhcp6(ifname : String)
|
||||
# we suppose udhcpc6 installed along with udhcpc
|
||||
unless Do.run("udhcpc6", [ ifname ]).success?
|
||||
raise "(udhcpc6) dhcp failed on #{ifname}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class DHClientCommand
|
||||
@ -191,6 +198,12 @@ class NetworkCommands
|
||||
raise "(dhclient) dhcp failed on #{ifname}"
|
||||
end
|
||||
end
|
||||
|
||||
def self.dhcp6(ifname : String)
|
||||
unless Do.run("dhclient", [ "-6", ifname ]).success?
|
||||
raise "(dhclient) dhcp6 failed on #{ifname}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class IfconfigCommand
|
||||
@ -367,6 +380,13 @@ class NetworkCommands
|
||||
|
||||
def self.autoconfiguration(ifname : String)
|
||||
puts "TODO: IPv6 autoconfiguration setup"
|
||||
puts "sysctl -w net.ipv6.conf.#{ifname}.autoconf=1"
|
||||
puts "sysctl -w net.ipv6.conf.#{ifname}.accept_ra=1"
|
||||
end
|
||||
|
||||
def self.dhcp6(ifname : String)
|
||||
puts "TODO: dhcpv6"
|
||||
@@cmd_dhcp_client.dhcp6 ifname
|
||||
end
|
||||
|
||||
def self.wireless_connect_wpa_psk(ifname : String, ssid : String, passwd : String)
|
||||
@ -613,20 +633,15 @@ class InterfaceConfiguration
|
||||
|
||||
# ipv6 configuration
|
||||
main_ip_v6.tap do |ip|
|
||||
puts "CONFIGURATION IPV6"
|
||||
|
||||
case ip
|
||||
when IPAddress
|
||||
NetworkCommands.set_ip name, ip
|
||||
# TODO
|
||||
when Autoconfiguration
|
||||
puts "CONFIGURATION IPV6 : autoconfiguration !!!"
|
||||
NetworkCommands.autoconfiguration name
|
||||
#when DHCP
|
||||
# NetworkCommands.dhcp6 name
|
||||
when DHCP
|
||||
NetworkCommands.dhcp6 name
|
||||
when NotSetup
|
||||
# do nothing
|
||||
puts "CONFIGURATION IPV6 : not setup !!!"
|
||||
else
|
||||
raise "ipv6 configuration: neither static nor dynamic"
|
||||
end
|
||||
@ -780,10 +795,7 @@ class NetworkConfigurationParser
|
||||
next
|
||||
end
|
||||
|
||||
# TODO
|
||||
ipaddr = IPAddress.parse ipstr
|
||||
|
||||
# TODO
|
||||
access_point = wireless_networks[ssid].not_nil!
|
||||
|
||||
if ipaddr.ipv4?
|
||||
|
Loading…
Reference in New Issue
Block a user