Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 355005
b: refs/heads/master
c: 0783d72
h: refs/heads/master
i:
  355003: ffd0729
v: v3
  • Loading branch information
Tomas Hozza authored and Greg Kroah-Hartman committed Jan 17, 2013
1 parent d7ee5b6 commit 43e23b1
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 44 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 00246d08be901b9ac27c3082bd066119b71b4679
refs/heads/master: 0783d72fa4cd8aae7c3f30746c70f6f3a2507594
59 changes: 29 additions & 30 deletions trunk/tools/hv/hv_kvp_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1162,16 +1162,13 @@ static int process_ip_string(FILE *f, char *ip_string, int type)
snprintf(str, sizeof(str), "%s", "DNS");
break;
}
if (i != 0) {
if (type != DNS) {
snprintf(sub_str, sizeof(sub_str),
"_%d", i++);
} else {
snprintf(sub_str, sizeof(sub_str),
"%d", ++i);
}
} else if (type == DNS) {

if (type == DNS) {
snprintf(sub_str, sizeof(sub_str), "%d", ++i);
} else if (type == GATEWAY && i == 0) {
++i;
} else {
snprintf(sub_str, sizeof(sub_str), "%d", i++);
}


Expand All @@ -1191,17 +1188,13 @@ static int process_ip_string(FILE *f, char *ip_string, int type)
snprintf(str, sizeof(str), "%s", "DNS");
break;
}
if ((j != 0) || (type == DNS)) {
if (type != DNS) {
snprintf(sub_str, sizeof(sub_str),
"_%d", j++);
} else {
snprintf(sub_str, sizeof(sub_str),
"%d", ++i);
}
} else if (type == DNS) {
snprintf(sub_str, sizeof(sub_str),
"%d", ++i);

if (type == DNS) {
snprintf(sub_str, sizeof(sub_str), "%d", ++i);
} else if (j == 0) {
++j;
} else {
snprintf(sub_str, sizeof(sub_str), "_%d", j++);
}
} else {
return HV_INVALIDARG;
Expand Down Expand Up @@ -1244,18 +1237,19 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
* Here is the format of the ip configuration file:
*
* HWADDR=macaddr
* IF_NAME=interface name
* DHCP=yes (This is optional; if yes, DHCP is configured)
* DEVICE=interface name
* BOOTPROTO=<protocol> (where <protocol> is "dhcp" if DHCP is configured
* or "none" if no boot-time protocol should be used)
*
* IPADDR=ipaddr1
* IPADDR_1=ipaddr2
* IPADDR_x=ipaddry (where y = x + 1)
* IPADDR0=ipaddr1
* IPADDR1=ipaddr2
* IPADDRx=ipaddry (where y = x + 1)
*
* NETMASK=netmask1
* NETMASK_x=netmasky (where y = x + 1)
* NETMASK0=netmask1
* NETMASKx=netmasky (where y = x + 1)
*
* GATEWAY=ipaddr1
* GATEWAY_x=ipaddry (where y = x + 1)
* GATEWAYx=ipaddry (where y = x + 1)
*
* DNSx=ipaddrx (where first DNS address is tagged as DNS1 etc)
*
Expand Down Expand Up @@ -1294,19 +1288,24 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
if (error)
goto setval_error;

error = kvp_write_file(file, "IF_NAME", "", if_name);
error = kvp_write_file(file, "DEVICE", "", if_name);
if (error)
goto setval_error;

if (new_val->dhcp_enabled) {
error = kvp_write_file(file, "DHCP", "", "yes");
error = kvp_write_file(file, "BOOTPROTO", "", "dhcp");
if (error)
goto setval_error;

/*
* We are done!.
*/
goto setval_done;

} else {
error = kvp_write_file(file, "BOOTPROTO", "", "none");
if (error)
goto setval_error;
}

/*
Expand Down
22 changes: 9 additions & 13 deletions trunk/tools/hv/hv_set_ifconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@
# Here is the format of the ip configuration file:
#
# HWADDR=macaddr
# IF_NAME=interface name
# DHCP=yes (This is optional; if yes, DHCP is configured)
# DEVICE=interface name
# BOOTPROTO=<protocol> (where <protocol> is "dhcp" if DHCP is configured
# or "none" if no boot-time protocol should be used)
#
# IPADDR=ipaddr1
# IPADDR_1=ipaddr2
# IPADDR_x=ipaddry (where y = x + 1)
# IPADDR0=ipaddr1
# IPADDR1=ipaddr2
# IPADDRx=ipaddry (where y = x + 1)
#
# NETMASK=netmask1
# NETMASK_x=netmasky (where y = x + 1)
# NETMASK0=netmask1
# NETMASKx=netmasky (where y = x + 1)
#
# GATEWAY=ipaddr1
# GATEWAY_x=ipaddry (where y = x + 1)
# GATEWAYx=ipaddry (where y = x + 1)
#
# DNSx=ipaddrx (where first DNS address is tagged as DNS1 etc)
#
Expand All @@ -53,11 +54,6 @@ echo "NM_CONTROLLED=no" >> $1
echo "PEERDNS=yes" >> $1
echo "ONBOOT=yes" >> $1

dhcp=$(grep "DHCP" $1 2>/dev/null)
if [ "$dhcp" != "" ];
then
echo "BOOTPROTO=dhcp" >> $1;
fi

cp $1 /etc/sysconfig/network-scripts/

Expand Down

0 comments on commit 43e23b1

Please sign in to comment.