Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package yast2-network for openSUSE:Factory checked in at 2023-01-14 00:02:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network" Sat Jan 14 00:02:21 2023 rev:490 rq:1057968 version:4.5.11 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2022-12-02 13:12:20.361589102 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-network.new.32243/yast2-network.changes 2023-01-14 00:02:27.713446738 +0100 @@ -1,0 +2,7 @@ +Thu Dec 29 06:44:50 UTC 2022 - Knut Anderssen <kanders...@suse.com> + +- Do not crash when the NETMASK or PREFIXLEN are invalid + (bsc#1206551). +- 4.5.11 + +------------------------------------------------------------------- Old: ---- yast2-network-4.5.10.tar.bz2 New: ---- yast2-network-4.5.11.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.kUADD4/_old 2023-01-14 00:02:28.417450839 +0100 +++ /var/tmp/diff_new_pack.kUADD4/_new 2023-01-14 00:02:28.421450862 +0100 @@ -1,7 +1,7 @@ # # spec file for package yast2-network # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.5.10 +Version: 4.5.11 Release: 0 Summary: YaST2 - Network Configuration License: GPL-2.0-only ++++++ yast2-network-4.5.10.tar.bz2 -> yast2-network-4.5.11.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.5.10/package/yast2-network.changes new/yast2-network-4.5.11/package/yast2-network.changes --- old/yast2-network-4.5.10/package/yast2-network.changes 2022-11-24 10:21:41.000000000 +0100 +++ new/yast2-network-4.5.11/package/yast2-network.changes 2022-12-30 10:37:49.000000000 +0100 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Thu Dec 29 06:44:50 UTC 2022 - Knut Anderssen <kanders...@suse.com> + +- Do not crash when the NETMASK or PREFIXLEN are invalid + (bsc#1206551). +- 4.5.11 + +------------------------------------------------------------------- Tue Nov 22 14:53:13 UTC 2022 - Martin Vidner <mvid...@suse.com> - Fix hash vs keyword arguments in RSpec expectations (bsc#1204871) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.5.10/package/yast2-network.spec new/yast2-network-4.5.11/package/yast2-network.spec --- old/yast2-network-4.5.10/package/yast2-network.spec 2022-11-24 10:21:41.000000000 +0100 +++ new/yast2-network-4.5.11/package/yast2-network.spec 2022-12-30 10:37:49.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.5.10 +Version: 4.5.11 Release: 0 Summary: YaST2 - Network Configuration License: GPL-2.0-only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.5.10/src/lib/y2network/wicked/connection_config_readers/base.rb new/yast2-network-4.5.11/src/lib/y2network/wicked/connection_config_readers/base.rb --- old/yast2-network-4.5.10/src/lib/y2network/wicked/connection_config_readers/base.rb 2022-11-24 10:21:41.000000000 +0100 +++ new/yast2-network-4.5.11/src/lib/y2network/wicked/connection_config_readers/base.rb 2022-12-30 10:37:49.000000000 +0100 @@ -142,7 +142,8 @@ @all_ips ||= file.ipaddrs.each_with_object([]) do |(id, ip), all| next unless ip.is_a?(Y2Network::IPAddress) - ip_address = build_ip(ip, file.prefixlens[id], file.netmasks[id]) + ip_address = build_ip(ip, id) + all << Y2Network::ConnectionConfig::IPConfig.new( ip_address, id: id, @@ -158,17 +159,55 @@ # It takes an IP address and, optionally, a prefix or a netmask. # # @param ip [Y2Network::IPAddress] IP address - # @param prefix [Integer,nil] Address prefix - # @param netmask [String,nil] Netmask - def build_ip(ip, prefix, netmask) + # @param id [String] Hash key for the IP Address + def build_ip(ip, id) ipaddr = ip.clone return ipaddr if ip.prefix? - ipaddr.netmask = netmask if netmask - ipaddr.prefix = prefix if prefix + assign_ip_netmask(ipaddr, id) + assign_ip_prefix(ipaddr, id) + ipaddr end + # @param ip [Y2Network::IPAddress] IP address + # @param id [String] Hash key for the IP Address + def assign_ip_netmask(ip, id) + netmask = file.netmasks[id] + return ip unless netmask + + begin + ip.netmask = netmask + rescue StandardError + issue_location = "file:#{file.path}:NETMASK#{id}" + issue = Y2Issues::InvalidValue.new( + netmask, fallback: nil, location: issue_location + ) + issues_list << issue + end + end + + # @param ip [Y2Network::IPAddress] IP address + # @param id [String] Hash key for the IP Address + def assign_ip_prefix(ip, id) + prefix = file.prefixlens[id] + return ip unless prefix + + address = ip.address.clone + begin + # Take advantage of the IPAddress address validations when the prefix is assigned not + # allowing an invalid one (bsc#1206551) + address.prefix = prefix + ip.prefix = prefix + rescue StandardError + issue_location = "file:#{file.path}:PREFIXLEN#{id}" + issue = Y2Issues::InvalidValue.new( + prefix, fallback: nil, location: issue_location + ) + issues_list << issue + end + end + # Returns the hostnames for the given connection # # @return [Array<String>] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.5.10/test/data/scr_read/etc/sysconfig/network/ifcfg-eth0 new/yast2-network-4.5.11/test/data/scr_read/etc/sysconfig/network/ifcfg-eth0 --- old/yast2-network-4.5.10/test/data/scr_read/etc/sysconfig/network/ifcfg-eth0 2022-11-24 10:21:41.000000000 +0100 +++ new/yast2-network-4.5.11/test/data/scr_read/etc/sysconfig/network/ifcfg-eth0 2022-12-30 10:37:49.000000000 +0100 @@ -1,7 +1,7 @@ BOOTPROTO='static' BROADCAST='' ETHTOOL_OPTIONS='' -IPADDR='192.168.123.1/24' +IPADDR='192.168.123.1/24' MTU='1500' NAME='Ethernet Card 0' NETWORK='' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.5.10/test/y2network/wicked/connection_config_readers/ethernet_test.rb new/yast2-network-4.5.11/test/y2network/wicked/connection_config_readers/ethernet_test.rb --- old/yast2-network-4.5.10/test/y2network/wicked/connection_config_readers/ethernet_test.rb 2022-11-24 10:21:41.000000000 +0100 +++ new/yast2-network-4.5.11/test/y2network/wicked/connection_config_readers/ethernet_test.rb 2022-12-30 10:37:49.000000000 +0100 @@ -145,5 +145,40 @@ expect(issue.message).to include("Invalid value 'automatic'") end end + + context "when the NETMASK is not valid" do + let(:interface_name) { "eth1" } + + before do + allow(file).to receive(:netmasks).and_return("_1" => "255.255.252.298") + end + + it "registers an issue" do + handler.connection_config + issue = issues_list.first + expect(issue.location.to_s).to eq( + "file:/etc/sysconfig/network/ifcfg-eth1:NETMASK_1" + ) + expect(issue.message).to include("Invalid value '255.255.252.298'") + end + end + + context "when the PREFIXLEN is not valid" do + let(:interface_name) { "eth2" } + + before do + allow(file).to receive(:prefixlens).and_return("" => 244) + end + + it "registers an issue" do + handler.connection_config + issue = issues_list.first + expect(issue.location.to_s).to eq( + "file:/etc/sysconfig/network/ifcfg-eth2:PREFIXLEN" + ) + expect(issue.message).to include("Invalid value '244'") + end + end + end end