Hello community, here is the log from the commit of package hyper-v for openSUSE:Factory checked in at 2012-10-23 19:37:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/hyper-v (Old) and /work/SRC/openSUSE:Factory/.hyper-v.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "hyper-v", Maintainer is "OHering@suse.com" Changes: -------- --- /work/SRC/openSUSE:Factory/hyper-v/hyper-v.changes 2012-09-05 09:17:13.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.hyper-v.new/hyper-v.changes 2012-10-23 19:37:43.000000000 +0200 @@ -1,0 +2,16 @@ +Sat Oct 13 11:40:30 CEST 2012 - ohering@suse.de + +- update hv_kvp_daemon + Return the full kernel version + Don't return loopback addresses + +------------------------------------------------------------------- +Thu Oct 4 15:14:05 CEST 2012 - ohering@suse.de + +- bump to version 4 +- update kv_kvp_daemon to 3.7-rc1 state [fate#31441] + support KVP IP Injection, helper scripts go to /usr/lib/hyper-v/bin: + hv_get_dhcp_info, hv_get_dns_info, hv_set_ifconfig +- remove usage of absolute paths in runlevel script + +------------------------------------------------------------------- @@ -7 +23 @@ - kernel + kernel [bnc#770763] Old: ---- hyper-v.tools.hv.hv_kvp_daemon.c.patch New: ---- full-kernel-version.patch hyper-v.tools.hv.hv_get_dhcp_info.sh hyper-v.tools.hv.hv_get_dns_info.sh hyper-v.tools.hv.hv_set_ifconfig.sh no-loopback.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hyper-v.spec ++++++ --- /var/tmp/diff_new_pack.dojl7T/_old 2012-10-23 19:37:46.000000000 +0200 +++ /var/tmp/diff_new_pack.dojl7T/_new 2012-10-23 19:37:46.000000000 +0200 @@ -39,7 +39,7 @@ Supplements: modalias(dmi*:svn*MicrosoftCorporation*:pn*VirtualMachine*:rn*VirtualMachine*) Supplements: modalias(pci:v00001414d00005353sv*sd*bc*sc*i*) Url: http://www.kernel.org -Version: 3 +Version: 4 Release: 0 Source: Module.supported Source1: hyperv_pvdrivers.conf @@ -50,7 +50,12 @@ Source9: hyper-v.include.linux.hyperv.h Source10: hyper-v.tools.hv.hv_kvp_daemon.c Source11: hyper-v.init.sh -Patch761200: hyper-v.tools.hv.hv_kvp_daemon.c.patch +Source20: hyper-v.tools.hv.hv_get_dhcp_info.sh +Source21: hyper-v.tools.hv.hv_get_dns_info.sh +Source22: hyper-v.tools.hv.hv_set_ifconfig.sh +Patch0: full-kernel-version.patch +Patch1: no-loopback.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-build %if %{with_kmp} %if %{with_drivers_in_kmp} @@ -84,7 +89,8 @@ cp -avL %{S:5} kvptest.ps1.txt cp -vL %{S:9} %{hv_kvp_daemon}.h cp -vL %{S:10} %{hv_kvp_daemon}.c -%patch761200 -p0 +%patch0 -p3 +%patch1 -p3 %build sed -i~ '/#include <linux.hyperv.h>/d' %{hv_kvp_daemon}.c @@ -125,6 +131,11 @@ %endif mkdir -p $RPM_BUILD_ROOT/usr/sbin install -m755 %{hv_kvp_daemon} $RPM_BUILD_ROOT/usr/sbin +mkdir -p $RPM_BUILD_ROOT/usr/lib/%{name}/bin +cp -avL %{S:20} $RPM_BUILD_ROOT/usr/lib/%{name}/bin/hv_get_dhcp_info +cp -avL %{S:21} $RPM_BUILD_ROOT/usr/lib/%{name}/bin/hv_get_dns_info +cp -avL %{S:22} $RPM_BUILD_ROOT/usr/lib/%{name}/bin/hv_set_ifconfig +chmod 755 $RPM_BUILD_ROOT/usr/lib/%{name}/bin/* mkdir -p $RPM_BUILD_ROOT/etc/init.d install -m755 %{S:11} $RPM_BUILD_ROOT/etc/init.d/%{hv_kvp_daemon} ln -sfvbn ../../etc/init.d/%{hv_kvp_daemon} $RPM_BUILD_ROOT/usr/sbin/rc%{hv_kvp_daemon} @@ -145,6 +156,7 @@ /etc/init.d/%{hv_kvp_daemon} /usr/sbin/rc%{hv_kvp_daemon} /usr/sbin/%{hv_kvp_daemon} +/usr/lib/%{name} %post board_vendor= ++++++ full-kernel-version.patch ++++++ From: "K. Y. Srinivasan" <kys@microsoft.com> Subject: [PATCH 1/1] tools: hv: Return the full kernel version Date: Fri, 12 Oct 2012 16:40:10 -0700 Message-Id: <1350085210-11108-1-git-send-email-kys@microsoft.com> Currently, we are returning the same string for both OSBuildNumber and OSVersion keys. Return the full uts string for the OSBuild key since Windows does not impose any restrictions on this. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Reported-by: Claudio Latini <claudio.latini@live.com> --- tools/hv/hv_kvp_daemon.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index 5959aff..6c7bcb9 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c @@ -88,6 +88,7 @@ static char *os_major = ""; static char *os_minor = ""; static char *processor_arch; static char *os_build; +static char *os_version; static char *lic_version = "Unknown version"; static struct utsname uts_buf; @@ -453,7 +454,9 @@ void kvp_get_os_info(void) char *p, buf[512]; uname(&uts_buf); - os_build = uts_buf.release; + os_version = uts_buf.release; + os_build = strdup(uts_buf.release); + os_name = uts_buf.sysname; processor_arch = uts_buf.machine; @@ -462,7 +465,7 @@ void kvp_get_os_info(void) * string to be of the form: x.y.z * Strip additional information we may have. */ - p = strchr(os_build, '-'); + p = strchr(os_version, '-'); if (p) *p = '\0'; @@ -1649,7 +1652,7 @@ int main(void) strcpy(key_name, "OSMinorVersion"); break; case OSVersion: - strcpy(key_value, os_build); + strcpy(key_value, os_version); strcpy(key_name, "OSVersion"); break; case ProcessorArchitecture: -- 1.7.4.1 ++++++ hyper-v.include.linux.hyperv.h ++++++ --- /var/tmp/diff_new_pack.dojl7T/_old 2012-10-23 19:37:46.000000000 +0200 +++ /var/tmp/diff_new_pack.dojl7T/_new 2012-10-23 19:37:46.000000000 +0200 @@ -122,12 +122,53 @@ #define REG_U32 4 #define REG_U64 8 +/* + * As we look at expanding the KVP functionality to include + * IP injection functionality, we need to maintain binary + * compatibility with older daemons. + * + * The KVP opcodes are defined by the host and it was unfortunate + * that I chose to treat the registration operation as part of the + * KVP operations defined by the host. + * Here is the level of compatibility + * (between the user level daemon and the kernel KVP driver) that we + * will implement: + * + * An older daemon will always be supported on a newer driver. + * A given user level daemon will require a minimal version of the + * kernel driver. + * If we cannot handle the version differences, we will fail gracefully + * (this can happen when we have a user level daemon that is more + * advanced than the KVP driver. + * + * We will use values used in this handshake for determining if we have + * workable user level daemon and the kernel driver. We begin by taking the + * registration opcode out of the KVP opcode namespace. We will however, + * maintain compatibility with the existing user-level daemon code. + */ + +/* + * Daemon code not supporting IP injection (legacy daemon). + */ + +#define KVP_OP_REGISTER 4 + +/* + * Daemon code supporting IP injection. + * The KVP opcode field is used to communicate the + * registration information; so define a namespace that + * will be distinct from the host defined KVP opcode. + */ + +#define KVP_OP_REGISTER1 100 + enum hv_kvp_exchg_op { KVP_OP_GET = 0, KVP_OP_SET, KVP_OP_DELETE, KVP_OP_ENUMERATE, - KVP_OP_REGISTER, + KVP_OP_GET_IP_INFO, + KVP_OP_SET_IP_INFO, KVP_OP_COUNT /* Number of operations, must be last. */ }; @@ -140,6 +181,39 @@ KVP_POOL_COUNT /* Number of pools, must be last. */ }; +/* + * Some Hyper-V status codes. + */ + +#define HV_S_OK 0x00000000 +#define HV_E_FAIL 0x80004005 +#define HV_S_CONT 0x80070103 +#define HV_ERROR_NOT_SUPPORTED 0x80070032 +#define HV_ERROR_MACHINE_LOCKED 0x800704F7 +#define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F +#define HV_INVALIDARG 0x80070057 +#define HV_GUID_NOTFOUND 0x80041002 + +#define ADDR_FAMILY_NONE 0x00 +#define ADDR_FAMILY_IPV4 0x01 +#define ADDR_FAMILY_IPV6 0x02 + +#define MAX_ADAPTER_ID_SIZE 128 +#define MAX_IP_ADDR_SIZE 1024 +#define MAX_GATEWAY_SIZE 512 + + +struct hv_kvp_ipaddr_value { + __u16 adapter_id[MAX_ADAPTER_ID_SIZE]; + __u8 addr_family; + __u8 dhcp_enabled; + __u16 ip_addr[MAX_IP_ADDR_SIZE]; + __u16 sub_net[MAX_IP_ADDR_SIZE]; + __u16 gate_way[MAX_GATEWAY_SIZE]; + __u16 dns_addr[MAX_IP_ADDR_SIZE]; +} __attribute__((packed)); + + struct hv_kvp_hdr { __u8 operation; __u8 pool; @@ -181,16 +255,26 @@ }; struct hv_kvp_msg { - struct hv_kvp_hdr kvp_hdr; + union { + struct hv_kvp_hdr kvp_hdr; + int error; + }; union { struct hv_kvp_msg_get kvp_get; struct hv_kvp_msg_set kvp_set; struct hv_kvp_msg_delete kvp_delete; struct hv_kvp_msg_enumerate kvp_enum_data; + struct hv_kvp_ipaddr_value kvp_ip_val; struct hv_kvp_register kvp_register; } body; } __attribute__((packed)); +struct hv_kvp_ip_msg { + __u8 operation; + __u8 pool; + struct hv_kvp_ipaddr_value kvp_ip_val; +} __attribute__((packed)); + #ifdef __KERNEL__ #include <linux/scatterlist.h> #include <linux/list.h> @@ -274,6 +358,33 @@ u32 bytes_avail_towrite; }; + +/* + * + * hv_get_ringbuffer_availbytes() + * + * Get number of bytes available to read and to write to + * for the specified ring buffer + */ +static inline void +hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi, + u32 *read, u32 *write) +{ + u32 read_loc, write_loc, dsize; + + smp_read_barrier_depends(); + + /* Capture the read/write indices before they changed */ + read_loc = rbi->ring_buffer->read_index; + write_loc = rbi->ring_buffer->write_index; + dsize = rbi->ring_datasize; + + *write = write_loc >= read_loc ? dsize - (write_loc - read_loc) : + read_loc - write_loc; + *read = dsize - *write; +} + + /* * We use the same version numbering for all Hyper-V modules. * @@ -378,7 +489,7 @@ struct vmtransfer_page_packet_header { struct vmpacket_descriptor d; u16 xfer_pageset_id; - bool sender_owns_set; + u8 sender_owns_set; u8 reserved; u32 range_cnt; struct vmtransfer_page_range ranges[1]; @@ -532,7 +643,7 @@ /* VMBus Version Supported parameters */ struct vmbus_channel_version_supported { struct vmbus_channel_message_header header; - bool version_supported; + u8 version_supported; } __packed; /* Offer Channel parameters */ @@ -541,7 +652,7 @@ struct vmbus_channel_offer offer; u32 child_relid; u8 monitorid; - bool monitor_allocated; + u8 monitor_allocated; } __packed; /* Rescind Offer parameters */ @@ -677,7 +788,7 @@ struct vmbus_channel_version_response { struct vmbus_channel_message_header header; - bool version_supported; + u8 version_supported; } __packed; enum vmbus_channel_state { @@ -950,11 +1061,6 @@ #define ICMSGHDRFLAG_REQUEST 2 #define ICMSGHDRFLAG_RESPONSE 4 -#define HV_S_OK 0x00000000 -#define HV_E_FAIL 0x80004005 -#define HV_S_CONT 0x80070103 -#define HV_ERROR_NOT_SUPPORTED 0x80070032 -#define HV_ERROR_MACHINE_LOCKED 0x800704F7 /* * While we want to handle util services as regular devices, @@ -1035,8 +1141,10 @@ void (*callback) (void *context); }; +#define MAX_SRV_VER 0x7ffffff extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, - struct icmsg_negotiate *, u8 *); + struct icmsg_negotiate *, u8 *, int, + int); int hv_kvp_init(struct hv_util_service *); void hv_kvp_deinit(void); ++++++ hyper-v.init.sh ++++++ --- /var/tmp/diff_new_pack.dojl7T/_old 2012-10-23 19:37:46.000000000 +0200 +++ /var/tmp/diff_new_pack.dojl7T/_new 2012-10-23 19:37:46.000000000 +0200 @@ -29,12 +29,13 @@ case "$1" in start) echo -n "Starting Hyper-V KVP daemon " - /sbin/startproc $HV_KVP_BIN + env PATH=/usr/lib/hyper-v/bin:$PATH \ + startproc $HV_KVP_BIN rc_status -v ;; stop) echo -n "Shutting down Hyper-V KVP daemon " - /sbin/killproc -TERM $HV_KVP_BIN + killproc -TERM $HV_KVP_BIN rc_status -v ;; try-restart|condrestart) @@ -70,7 +71,7 @@ ;; status) echo -n "Checking for service Hyper-V KVP daemon " - /sbin/checkproc $HV_KVP_BIN + checkproc $HV_KVP_BIN rc_status -v ;; *) ++++++ hyper-v.tools.hv.hv_get_dhcp_info.sh ++++++ #!/bin/bash # This example script retrieves the DHCP state of a given interface. # In the interest of keeping the KVP daemon code free of distro specific # information; the kvp daemon code invokes this external script to gather # DHCP setting for the specific interface. # # Input: Name of the interface # # Output: The script prints the string "Enabled" to stdout to indicate # that DHCP is enabled on the interface. If DHCP is not enabled, # the script prints the string "Disabled" to stdout. # # Each Distro is expected to implement this script in a distro specific # fashion. For instance on Distros that ship with Network Manager enabled, # this script can be based on the Network Manager APIs for retrieving DHCP # information. if_file="/etc/sysconfig/network-scripts/ifcfg-"$1 dhcp=$(grep "dhcp" $if_file 2>/dev/null) if [ "$dhcp" != "" ]; then echo "Enabled" else echo "Disabled" fi ++++++ hyper-v.tools.hv.hv_get_dns_info.sh ++++++ #!/bin/bash # This example script parses /etc/resolv.conf to retrive DNS information. # In the interest of keeping the KVP daemon code free of distro specific # information; the kvp daemon code invokes this external script to gather # DNS information. # This script is expected to print the nameserver values to stdout. # Each Distro is expected to implement this script in a distro specific # fashion. For instance on Distros that ship with Network Manager enabled, # this script can be based on the Network Manager APIs for retrieving DNS # entries. cat /etc/resolv.conf 2>/dev/null | awk '/^nameserver/ { print $2 }' ++++++ hyper-v.tools.hv.hv_kvp_daemon.c ++++++ ++++ 1385 lines (skipped) ++++ between /work/SRC/openSUSE:Factory/hyper-v/hyper-v.tools.hv.hv_kvp_daemon.c ++++ and /work/SRC/openSUSE:Factory/.hyper-v.new/hyper-v.tools.hv.hv_kvp_daemon.c ++++++ hyper-v.tools.hv.hv_set_ifconfig.sh ++++++ #!/bin/bash # This example script activates an interface based on the specified # configuration. # # In the interest of keeping the KVP daemon code free of distro specific # information; the kvp daemon code invokes this external script to configure # the interface. # # The only argument to this script is the configuration file that is to # be used to configure the interface. # # Each Distro is expected to implement this script in a distro specific # fashion. For instance on Distros that ship with Network Manager enabled, # this script can be based on the Network Manager APIs for configuring the # interface. # # This example script is based on a RHEL environment. # # 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) # # IPADDR=ipaddr1 # IPADDR_1=ipaddr2 # IPADDR_x=ipaddry (where y = x + 1) # # NETMASK=netmask1 # NETMASK_x=netmasky (where y = x + 1) # # GATEWAY=ipaddr1 # GATEWAY_x=ipaddry (where y = x + 1) # # DNSx=ipaddrx (where first DNS address is tagged as DNS1 etc) # # IPV6 addresses will be tagged as IPV6ADDR, IPV6 gateway will be # tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as # IPV6NETMASK. # # The host can specify multiple ipv4 and ipv6 addresses to be # configured for the interface. Furthermore, the configuration # needs to be persistent. A subsequent GET call on the interface # is expected to return the configuration that is set via the SET # call. # echo "IPV6INIT=yes" >> $1 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/ interface=$(echo $1 | awk -F - '{ print $2 }') /sbin/ifdown $interface 2>/dev/null /sbin/ifup $interfac 2>/dev/null ++++++ no-loopback.patch ++++++ From: "K. Y. Srinivasan" <kys@microsoft.com> Subject: [PATCH 1/1] Tools: hv: Don't return loopback addresses Date: Fri, 12 Oct 2012 16:41:48 -0700 Message-Id: <1350085308-11152-1-git-send-email-kys@microsoft.com> Don't return loopback addresses and further don't terminate the IP address strings with a semicolon. This is the current behavior of Windows guests. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Reported-by: Claudio Latini <claudio.latini@live.com> --- tools/hv/hv_kvp_daemon.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index 6c7bcb9..13c2a14 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c @@ -43,6 +43,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <dirent.h> +#include <net/if.h> /* * KVP protocol: The user mode component first registers with the @@ -882,7 +883,7 @@ static int kvp_process_ip_address(void *addrp, addr_length = INET6_ADDRSTRLEN; } - if ((length - *offset) < addr_length + 1) + if ((length - *offset) < addr_length + 2) return HV_E_FAIL; if (str == NULL) { strcpy(buffer, "inet_ntop failed\n"); @@ -890,11 +891,13 @@ static int kvp_process_ip_address(void *addrp, } if (*offset == 0) strcpy(buffer, tmp); - else + else { + strcat(buffer, ";"); strcat(buffer, tmp); - strcat(buffer, ";"); + } *offset += strlen(str) + 1; + return 0; } @@ -956,7 +959,9 @@ kvp_get_ip_info(int family, char *if_name, int op, * supported address families; if not we gather info on * the specified address family. */ - if ((family != 0) && (curp->ifa_addr->sa_family != family)) { + if ((((family != 0) && + (curp->ifa_addr->sa_family != family))) || + (curp->ifa_flags & IFF_LOOPBACK)) { curp = curp->ifa_next; continue; } -- 1.7.4.1 -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org