Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package hyper-v for openSUSE:Factory checked 
in at 2025-01-09 15:05:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/hyper-v (Old)
 and      /work/SRC/openSUSE:Factory/.hyper-v.new.1881 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "hyper-v"

Thu Jan  9 15:05:51 2025 rev:47 rq:1236106 version:9

Changes:
--------
--- /work/SRC/openSUSE:Factory/hyper-v/hyper-v.changes  2024-10-23 
21:07:51.556665304 +0200
+++ /work/SRC/openSUSE:Factory/.hyper-v.new.1881/hyper-v.changes        
2025-01-09 15:06:32.266056761 +0100
@@ -1,0 +2,13 @@
+Wed Jan  1 01:01:01 UTC 2025 - [email protected]
+
+- update route parsing in kvp daemon
+- reduce resource usage in hv_kvp_daemon (175c71c2)
+- reduce resouce usage in hv_get_dns_info helper (a4d024fe)
+- hv_kvp_daemon: Pass NIC name to hv_get_dns_info as well (07dfa6e8)
+- terminate fcopy daemon if read from uio fails (a9640fcd)
+- change permissions of NetworkManager configuration file (91ae69c7)
+- Fix a complier warning in the fcopy uio daemon (cb1b78f1)
+- remove obsolete kvptest.ps1.txt which failed since a decade
+- remove obsolete rpm postinstall code for SLE11SP2
+
+-------------------------------------------------------------------

Old:
----
  hyper-v.kvptest.ps1.txt

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ hyper-v.spec ++++++
--- /var/tmp/diff_new_pack.KBtVzc/_old  2025-01-09 15:06:32.898083043 +0100
+++ /var/tmp/diff_new_pack.KBtVzc/_new  2025-01-09 15:06:32.898083043 +0100
@@ -43,7 +43,6 @@
 Version:        9
 Release:        0
 Source0:        hyper-v.lsvmbus.py
-Source5:        hyper-v.kvptest.ps1.txt
 Source7:        hyper-v.compare-with-upstream.sh
 Source8:        hyper-v.tools.hv.vmbus_bufring.h
 Source9:        hyper-v.include.linux.hyperv.h
@@ -63,7 +62,6 @@
 
 %prep
 %setup -Tc
-cp -avL %{S:5} kvptest.ps1.txt
 cp -vL %{S:8} %vmbus_bufring.h
 cp -vL %{S:9} %include_uapi_linux_hyperv.h
 cp -vL %{S:10} .
@@ -263,57 +261,14 @@
 %?python3_fix_shebang
 
 %files
-%doc kvptest.ps1.txt
 %_unitdir/*
 %_udevrulesdir/*
 %_sbindir/*
 %helper_dir
 
-%pre
-# hv_kvp_daemon in SLES11 SP2 stored temporary state files in /var/opt
-# move them to /var/lib and remove old directory, if possible.
-if test -d /var/opt/hyperv
-then
-       if mkdir -p -v -m 0755 /var/lib/hyperv
-       then
-               cd /var/lib/hyperv
-               for oldfile in /var/opt/hyperv/ifcfg-* 
/var/opt/hyperv/.kvp_pool_*
-               do
-                       if test -e "${oldfile}"
-                       then
-                               mv -vfb "${oldfile}" . || :
-                       fi
-               done
-               cd - >/dev/null
-       fi
-       rmdir -v  /var/opt/hyperv || :
-fi
-: nothing to do in case of systemd
-
+# the relevant part is systemctl daemon-reload, due to udev triggers
 %post
-board_vendor=
-product_name=
-if cd /sys/class/dmi/id 2>/dev/null
-then
-       if test -r board_vendor
-       then
-               board_vendor="`cat board_vendor`"
-       fi
-       if test -r product_name
-       then
-               product_name="`cat product_name`"
-       fi
-       cd - >/dev/null
-fi
-if test "${board_vendor}" = "Microsoft Corporation" -a "${product_name}" = 
"Virtual Machine"
-then
-: nothing to do in case of systemd
-fi
-
-%preun
-: nothing to do in case of systemd
-
+%service_add_post %hv_kvp_daemon %hv_vss_daemon %hv_fcopy_daemon 
%hv_fcopy_uio_daemon
 %postun
-# no restart on update because the daemon can not be restarted
-: nothing to do in case of systemd
+%service_del_postun_without_restart %hv_kvp_daemon %hv_vss_daemon 
%hv_fcopy_daemon %hv_fcopy_uio_daemon
 

++++++ hyper-v.kvp.gethostname.patch ++++++
--- /var/tmp/diff_new_pack.KBtVzc/_old  2025-01-09 15:06:32.950085206 +0100
+++ /var/tmp/diff_new_pack.KBtVzc/_new  2025-01-09 15:06:32.954085373 +0100
@@ -1,5 +1,131 @@
 --- a/hyper-v.tools.hv.hv_kvp_daemon.c
 +++ b/hyper-v.tools.hv.hv_kvp_daemon.c
+@@ -24,6 +24,7 @@
+ 
+ #include <sys/poll.h>
+ #include <sys/utsname.h>
++#include <stdbool.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+@@ -677,6 +678,83 @@ static void kvp_process_ipconfig_file(ch
+       pclose(file);
+ }
+ 
++static bool kvp_verify_ip_address(void *address_string)
++{
++      char verify_buf[sizeof(struct in6_addr)];
++
++      if (inet_pton(AF_INET, address_string, verify_buf) == 1)
++              return true;
++      if (inet_pton(AF_INET6, address_string, verify_buf) == 1)
++              return true;
++      return false;
++}
++
++static void kvp_extract_routes(void **output, size_t *output_len, char *line)
++{
++      static const char needle[] = "via ";
++      char *match, *haystack = line;
++
++      while ((match = strstr(haystack, needle))) {
++              char *address, *end;
++
++              /* Address starts after needle. */
++              address = match + strlen(needle);
++
++              /* The char following address is a space or end of line. */
++              end = strpbrk(address, " \t\\");
++              if (!end)
++                      end = address + strlen(address) + 1;
++
++              /* Enough room for address and semicolon. */
++              if (*output_len >= (end - address) + 1) {
++                      memcpy(*output, address, end - address);
++                      /* Terminate string for verification. */
++                      memcpy(*output + (end - address), "", 1);
++                      if (kvp_verify_ip_address(*output)) {
++                              /* Advance output buffer. */
++                              *output += end - address;
++                              *output_len -= end - address;
++
++                              /* Each address needs a trailing semicolon. */
++                              memcpy(*output, ";", 1);
++                              *output += 1;
++                              *output_len -= 1;
++                      }
++              }
++              haystack = end;
++      }
++}
++
++static void kvp_get_gateway(void *buffer, size_t buffer_len)
++{
++      static const char needle[] = "default ";
++      FILE *f;
++      void *output = buffer;
++      char *line = NULL;
++      size_t alloc_size = 0, output_len = buffer_len - 1;
++      ssize_t num_chars;
++
++      /* Show route information in a single line, for each address family */
++      f = popen("ip --oneline -4 route show;exec ip --oneline -6 route show", 
"r");
++      while ((num_chars = getline(&line, &alloc_size, f)) > 0) {
++              /* Skip short lines. */
++              if (num_chars <= strlen(needle))
++                      continue;
++              /* Skip lines without default route. */
++              if (memcmp(line, needle, strlen(needle)))
++                      continue;
++              /* Remove trailing newline to simplify further parsing. */
++              if (line[num_chars - 1] == '\n')
++                      line[num_chars - 1] = '\0';
++              /* Search routes after match. */
++              kvp_extract_routes(&output, &output_len, line + strlen(needle));
++      }
++      /* Convert buffer into C-String. */
++      memcpy(output, "", 1);
++      free(line);
++      pclose(f);
++}
++
+ static void kvp_get_ipconfig_info(char *if_name,
+                                struct hv_kvp_ipaddr_value *buffer)
+ {
+@@ -684,32 +762,7 @@ static void kvp_get_ipconfig_info(char *
+       char dhcp_info[128];
+       char *p;
+       FILE *file;
+-
+-      /*
+-       * Get the address of default gateway (ipv4).
+-       */
+-      sprintf(cmd, "%s %s", "ip route show dev", if_name);
+-      strcat(cmd, " | awk '/default/ {print $3 }'");
+-
+-      /*
+-       * Execute the command to gather gateway info.
+-       */
+-      kvp_process_ipconfig_file(cmd, (char *)buffer->gate_way,
+-                              (MAX_GATEWAY_SIZE * 2), INET_ADDRSTRLEN, 0);
+-
+-      /*
+-       * Get the address of default gateway (ipv6).
+-       */
+-      sprintf(cmd, "%s %s", "ip -f inet6  route show dev", if_name);
+-      strcat(cmd, " | awk '/default/ {print $3 }'");
+-
+-      /*
+-       * Execute the command to gather gateway info (ipv6).
+-       */
+-      kvp_process_ipconfig_file(cmd, (char *)buffer->gate_way,
+-                              (MAX_GATEWAY_SIZE * 2), INET6_ADDRSTRLEN, 1);
+-
+-
++      kvp_get_gateway(buffer->gate_way, sizeof(buffer->gate_way));
+       /*
+        * Gather the DNS state.
+        * Since there is no standard way to get this information
 @@ -1335,6 +1335,7 @@ kvp_get_domain_name(char *buffer, int le
        struct addrinfo hints, *info ;
        int error = 0;

++++++ hyper-v.tools.hv.hv_fcopy_uio_daemon.c ++++++
--- /var/tmp/diff_new_pack.KBtVzc/_old  2025-01-09 15:06:32.986086702 +0100
+++ /var/tmp/diff_new_pack.KBtVzc/_new  2025-01-09 15:06:32.990086869 +0100
@@ -35,8 +35,6 @@
 #define WIN8_SRV_MINOR         1
 #define WIN8_SRV_VERSION       (WIN8_SRV_MAJOR << 16 | WIN8_SRV_MINOR)
 
-#define MAX_FOLDER_NAME                15
-#define MAX_PATH_LEN           15
 #define FCOPY_UIO              
"/sys/bus/vmbus/devices/eb765408-105f-49b6-b4aa-c123b64d17d4/uio"
 
 #define FCOPY_VER_COUNT                1
@@ -51,7 +49,7 @@
 
 #define HV_RING_SIZE           0x4000 /* 16KB ring buffer size */
 
-unsigned char desc[HV_RING_SIZE];
+static unsigned char desc[HV_RING_SIZE];
 
 static int target_fd;
 static char target_fname[PATH_MAX];
@@ -409,8 +407,8 @@
        struct vmbus_br txbr, rxbr;
        void *ring;
        uint32_t len = HV_RING_SIZE;
-       char uio_name[MAX_FOLDER_NAME] = {0};
-       char uio_dev_path[MAX_PATH_LEN] = {0};
+       char uio_name[NAME_MAX] = {0};
+       char uio_dev_path[PATH_MAX] = {0};
 
        static struct option long_options[] = {
                {"help",        no_argument,       0,  'h' },
@@ -468,8 +466,10 @@
                 */
                ret = pread(fcopy_fd, &tmp, sizeof(int), 0);
                if (ret < 0) {
+                       if (errno == EINTR || errno == EAGAIN)
+                               continue;
                        syslog(LOG_ERR, "pread failed: %s", strerror(errno));
-                       continue;
+                       goto close;
                }
 
                len = HV_RING_SIZE;

++++++ hyper-v.tools.hv.hv_get_dns_info.sh ++++++
--- /var/tmp/diff_new_pack.KBtVzc/_old  2025-01-09 15:06:33.010087700 +0100
+++ /var/tmp/diff_new_pack.KBtVzc/_new  2025-01-09 15:06:33.014087867 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 # This script parses /etc/resolv.conf to retrive DNS information.
 # In the interest of keeping the KVP daemon code free of distro specific
@@ -10,8 +10,9 @@
 # this script can be based on the Network Manager APIs for retrieving DNS
 # entries.
 
-if test -r /etc/resolv.conf
+if test -f /etc/resolv.conf
 then
-       awk -- '/^nameserver/ { print $2 }' /etc/resolv.conf
+       exec awk -- '/^nameserver/ { print $2 }' /etc/resolv.conf
 fi
+exit 0
 

++++++ hyper-v.tools.hv.hv_kvp_daemon.c ++++++
--- /var/tmp/diff_new_pack.KBtVzc/_old  2025-01-09 15:06:33.030088533 +0100
+++ /var/tmp/diff_new_pack.KBtVzc/_new  2025-01-09 15:06:33.034088699 +0100
@@ -725,7 +725,7 @@
         * .
         */
 
-       sprintf(cmd, KVP_SCRIPTS_PATH "%s",  "hv_get_dns_info");
+       sprintf(cmd, "exec %s %s", KVP_SCRIPTS_PATH "hv_get_dns_info", if_name);
 
        /*
         * Execute the command to gather DNS info.
@@ -742,7 +742,7 @@
         * Enabled: DHCP enabled.
         */
 
-       sprintf(cmd, KVP_SCRIPTS_PATH "%s %s", "hv_get_dhcp_info", if_name);
+       sprintf(cmd, "exec %s %s", KVP_SCRIPTS_PATH "hv_get_dhcp_info", 
if_name);
 
        file = popen(cmd, "r");
        if (file == NULL)
@@ -1606,8 +1606,9 @@
         * invoke the external script to do its magic.
         */
 
-       str_len = snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s %s",
-                          "hv_set_ifconfig", if_filename, nm_filename);
+       str_len = snprintf(cmd, sizeof(cmd), "exec %s %s %s",
+                          KVP_SCRIPTS_PATH "hv_set_ifconfig",
+                          if_filename, nm_filename);
        /*
         * This is a little overcautious, but it's necessary to suppress some
         * false warnings from gcc 8.0.1.

Reply via email to