106 |
|
|
107 |
register_client() |
register_client() |
108 |
{ |
{ |
109 |
|
local control_server |
110 |
local control_server_ip |
local control_server_ip |
111 |
local iface_ip |
local iface_ip |
112 |
local iface |
local iface |
113 |
local mac_address |
local mac_address |
114 |
|
|
115 |
control_server_ip=$(dns_to_ip ${MCORE_CONTROL_SERVER}) |
control_server=$(mcore-controlserver) |
116 |
|
if [[ $? != 0 ]] |
117 |
|
then |
118 |
|
decho "Could not communicate with the controlserver" |
119 |
|
return 1 |
120 |
|
fi |
121 |
|
|
122 |
|
control_server_ip=$(dns_to_ip ${control_server}) |
123 |
if [[ -z ${control_server_ip} ]] |
if [[ -z ${control_server_ip} ]] |
124 |
then |
then |
125 |
decho "Could not resolve control server ip, dns_to_ip(${MCORE_CONTROL_SERVER}) failed" |
decho "Could not resolve control server ip, dns_to_ip(${control_server}) failed" |
126 |
return 1 |
return 1 |
127 |
fi |
fi |
128 |
|
|
129 |
iface_ip=$(iface_for_remote_addr ${control_server_ip}) |
iface_ip=$(iface_for_remote_addr ${control_server_ip}) |
130 |
if [[ -z ${iface_ip} ]] |
if [[ -z ${iface_ip} ]] |
131 |
then |
then |
132 |
decho "Could not resolve interface ip, iface_ip(${control_server_ip}) failed" |
decho "Could not resolve interface ip, iface_ip(${control_server_ip}) failed" |
133 |
return 1 |
return 1 |
134 |
fi |
fi |
135 |
|
|
136 |
iface=$(iface_for_ip ${iface_ip}) |
iface=$(iface_for_ip ${iface_ip}) |
137 |
if [[ -z ${iface} ]] |
if [[ -z ${iface} ]] |
138 |
then |
then |
139 |
decho "Could not resolve interface for referencing ip address, iface_for_ip(${iface_ip}) failed" |
decho "Could not resolve interface for referencing ip address, iface_for_ip(${iface_ip}) failed" |
140 |
return 1 |
return 1 |
141 |
fi |
fi |
142 |
|
|
143 |
mac_address=$(mac_for_iface ${iface}) |
mac_address=$(mac_for_iface ${iface}) |
144 |
if [[ -z ${mac_address} ]] |
if [[ -z ${mac_address} ]] |
145 |
then |
then |
147 |
return 1 |
return 1 |
148 |
fi |
fi |
149 |
|
|
150 |
decho "MCORE_CONTROL_SERVER='${MCORE_CONTROL_SERVER}'" |
decho "control_server='${control_server}'" |
151 |
decho "iface_ip='${iface_ip}'" |
decho "iface_ip='${iface_ip}'" |
152 |
decho "iface='${iface}'" |
decho "iface='${iface}'" |
153 |
decho "mac_address='${mac_address}'" |
decho "mac_address='${mac_address}'" |