Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtnl: parse peer address on non-ptp interfaces #988

Merged
merged 2 commits into from
Oct 18, 2023

Conversation

mtomaschewski
Copy link
Member

@mtomaschewski mtomaschewski commented Oct 16, 2023

Due to the incomplete parsing the peer address were empty
and caused an error in attempts to delete it while ifdown.

@mtomaschewski
Copy link
Member Author

See also further comments in #987

@mtomaschewski
Copy link
Member Author

mtomaschewski commented Oct 17, 2023

Reproducer:

cat ifcfg-eth4

STARTMODE=auto
BOOTPROTO=static

IPADDR_40=172.22.49.10
REMOTE_IPADDR_40=172.22.49.1
IPADDR_41=172.22.49.11/24
IPADDR_42=172.22.49.12

IPADDR_60=2001:db8::10
REMOTE_IPADDR_60=2001:db8::1
IPADDR_61=2001:db8::11/64
IPADDR_62=2001:db8::12

ifup eth4

eth4            up

ip addr show dev eth4

5: eth4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:1b:21:53:06:57 brd ff:ff:ff:ff:ff:ff
    altname enp7s0f1
    inet 172.22.49.10 peer 172.22.49.1/32 scope global eth4	<--- OK
       valid_lft forever preferred_lft forever
    inet 172.22.49.11/24 brd 172.22.49.255 scope global eth4
       valid_lft forever preferred_lft forever
    inet 172.22.49.12/32 scope global eth4
       valid_lft forever preferred_lft forever
    inet6 2001:db8::12/128 scope global
       valid_lft forever preferred_lft forever
    inet6 2001:db8::11/64 scope global
       valid_lft forever preferred_lft forever
    inet6 2001:db8::10 peer 2001:db8::1/128 scope global	<--- OK
       valid_lft forever preferred_lft forever
    inet6 fe80::21b:21ff:fe53:657/64 scope link
       valid_lft forever preferred_lft forever

wicked ifstatus eth4

eth4            up
      link:     #5, state up, mtu 1500
      type:     ethernet, hwaddr 00:1b:21:53:06:57
      config:   compat:suse:/etc/sysconfig/network/ifcfg-eth4
      leases:   ipv4 static granted
      leases:   ipv6 static granted
      addr:     ipv4 172.22.49.1/32				<--- !!!
      addr:     ipv6 2001:db8::12/128 [static]
      addr:     ipv6 2001:db8::11/64 [static]
      addr:     ipv6 2001:db8::1/128				<--- !!!
      addr:     ipv4 172.22.49.11/24 [static]
      addr:     ipv4 172.22.49.12/32 [static]

wicked ifstatus --verbose eth4

eth4            up
      link:     #5, state up, mtu 1500
      type:     ethernet, hwaddr 00:1b:21:53:06:57
      control:  none
      config:   compat:suse:/etc/sysconfig/network/ifcfg-eth4,
                uuid: 96a6aba4-c445-5ade-83e9-d1893931919c
      leases:   ipv4 static granted
      leases:   ipv6 static granted
      addr:     ipv6 fe80::21b:21ff:fe53:657/64 scope link
      addr:     ipv6 2001:db8::12/128 scope universe [static]
      addr:     ipv6 2001:db8::11/64 scope universe [static]
      addr:     ipv6 2001:db8::1/128 scope universe                         <--- !!!
      addr:     ipv4 172.22.49.1/32 scope universe label eth4         <--- !!!
      addr:     ipv4 172.22.49.11/24 brd 172.22.49.11 scope universe label eth4 [static]
      addr:     ipv4 172.22.49.12/32 scope universe label eth4 [static]
      route:    ipv4 172.22.49.0/24 type unicast table main scope link protocol kernel pref-src 172.22.49.11
      route:    ipv4 172.22.49.1/32 type unicast table main scope link protocol kernel pref-src 172.22.49.10
      route:    ipv6 2001:db8::1/128 type unicast table main scope universe protocol kernel priority 256
      route:    ipv6 2001:db8::10/128 type unicast table main scope universe protocol kernel priority 256
      route:    ipv6 2001:db8::12/128 type unicast table main scope universe protocol kernel priority 256
      route:    ipv6 2001:db8::/64 type unicast table main scope universe protocol kernel priority 256
      route:    ipv6 fe80::/64 type unicast table main scope universe protocol kernel priority 256

wicked show-xml eth4

<!--  [...] -->
    <addresses>
      <assigned-address>
        <local>172.22.49.1/32</local>				<!- <--- !!! -->
        <scope>universe</scope>
        <flags>128</flags>
        <label>eth4</label>
      </assigned-address>
      <assigned-address>
        <local>fe80::21b:21ff:fe53:657/64</local>
        <scope>link</scope>
        <flags>128</flags>
      </assigned-address>
      <assigned-address>
        <local>2001:db8::12/128</local>
        <scope>universe</scope>
        <flags>128</flags>
        <owner>static</owner>
      </assigned-address>
      <assigned-address>
        <local>2001:db8::11/64</local>
        <scope>universe</scope>
        <flags>128</flags>
        <owner>static</owner>
      </assigned-address>
      <assigned-address>
        <local>2001:db8::1/128</local>				<!- <-- !!! -->
        <scope>universe</scope>
        <flags>128</flags>
      </assigned-address>
      <assigned-address>
        <local>172.22.49.11/24</local>
        <broadcast>172.22.49.255</broadcast>
        <scope>universe</scope>
        <flags>128</flags>
        <label>eth4</label>
        <owner>static</owner>
      </assigned-address>
      <assigned-address>
        <local>172.22.49.12/32</local>
        <scope>universe</scope>
        <flags>128</flags>
        <label>eth4</label>
        <owner>static</owner>
      </assigned-address>
    </addresses>
<!-- [...] -->

wicked ifdown eth4

eth4            device-ready

ip a s dev eth4

5: eth4: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 00:1b:21:53:06:57 brd ff:ff:ff:ff:ff:ff
    altname enp7s0f1
    inet 172.22.49.10 peer 172.22.49.1/32 scope global eth4	<--- !!!
       valid_lft forever preferred_lft forever

journalctl -u wickedd.service -f

Okt 17 13:00:51 nemesis wickedd[5182]: __ni_rtnl_send_deladdr(172.22.49.1/32): rtnl_talk failed: Invalid address for specified address family

@mtomaschewski mtomaschewski self-assigned this Oct 17, 2023
@mtomaschewski
Copy link
Member Author

Verification

cat ifcfg-eth4

STARTMODE=auto
BOOTPROTO=static

IPADDR_40=172.22.49.10
REMOTE_IPADDR_40=172.22.49.1
IPADDR_41=172.22.49.11/24
IPADDR_42=172.22.49.12

IPADDR_60=2001:db8::10
REMOTE_IPADDR_60=2001:db8::1
IPADDR_61=2001:db8::11/64
IPADDR_62=2001:db8::12

ifup eth4

eth4            up

ip addr show dev eth4

5: eth4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:1b:21:53:06:57 brd ff:ff:ff:ff:ff:ff
    altname enp7s0f1
    inet 172.22.49.10 peer 172.22.49.1/32 scope global eth4                                     <--- OK
       valid_lft forever preferred_lft forever
    inet 172.22.49.11/24 brd 172.22.49.255 scope global eth4
       valid_lft forever preferred_lft forever
    inet 172.22.49.12/32 scope global eth4
       valid_lft forever preferred_lft forever
    inet6 2001:db8::12/128 scope global
       valid_lft forever preferred_lft forever
    inet6 2001:db8::11/64 scope global
       valid_lft forever preferred_lft forever
    inet6 2001:db8::10 peer 2001:db8::1/128 scope global                                        <--- OK
       valid_lft forever preferred_lft forever
    inet6 fe80::21b:21ff:fe53:657/64 scope link
       valid_lft forever preferred_lft forever

wicked ifstatus eth4

eth4            up
      link:     #5, state up, mtu 1500
      type:     ethernet, hwaddr 00:1b:21:53:06:57
      config:   compat:suse:/etc/sysconfig/network/ifcfg-eth4
      leases:   ipv4 static granted
      leases:   ipv6 static granted
      addr:     ipv6 2001:db8::12/128 [static]                                                  <--- fixed
      addr:     ipv6 2001:db8::11/64 [static]
      addr:     ipv6 2001:db8::10/128 [static]
      addr:     ipv4 172.22.49.10/32 [static]                                                   <--- fixed
      addr:     ipv4 172.22.49.11/24 [static]
      addr:     ipv4 172.22.49.12/32 [static]

wicked ifstatus --verbose eth4

eth4            up
      link:     #5, state up, mtu 1500
      type:     ethernet, hwaddr 00:1b:21:53:06:57
      control:  none
      config:   compat:suse:/etc/sysconfig/network/ifcfg-eth4,
                uuid: 96a6aba4-c445-5ade-83e9-d1893931919c
      leases:   ipv4 static granted
      leases:   ipv6 static granted
      addr:     ipv6 fe80::21b:21ff:fe53:657/64 scope link
      addr:     ipv6 2001:db8::12/128 scope universe [static]
      addr:     ipv6 2001:db8::11/64 scope universe [static]
      addr:     ipv6 2001:db8::10/128 peer 2001:db8::1 scope universe [static]                  <--- fixed
      addr:     ipv4 172.22.49.10/32 peer 172.22.49.1 scope universe label eth4 [static]        <--- fixed
      addr:     ipv4 172.22.49.11/24 brd 172.22.49.11 scope universe label eth4 [static]
      addr:     ipv4 172.22.49.12/32 scope universe label eth4 [static]
      route:    ipv4 172.22.49.0/24 type unicast table main scope link protocol kernel pref-src 172.22.49.11
      route:    ipv4 172.22.49.1/32 type unicast table main scope link protocol kernel pref-src 172.22.49.10
      route:    ipv6 2001:db8::1/128 type unicast table main scope universe protocol kernel priority 256
      route:    ipv6 2001:db8::10/128 type unicast table main scope universe protocol kernel priority 256
      route:    ipv6 2001:db8::12/128 type unicast table main scope universe protocol kernel priority 256
      route:    ipv6 2001:db8::/64 type unicast table main scope universe protocol kernel priority 256
      route:    ipv6 fe80::/64 type unicast table main scope universe protocol kernel priority 256

wicked show-xml eth4

<!-- [...] -->
    <addresses>
      <assigned-address>
        <local>fe80::21b:21ff:fe53:657/64</local>
        <scope>link</scope>
        <flags>128</flags>
      </assigned-address>
      <assigned-address>
        <local>2001:db8::12/128</local>
        <scope>universe</scope>
        <flags>128</flags>
        <owner>static</owner>
      </assigned-address>
      <assigned-address>
        <local>2001:db8::11/64</local>
        <scope>universe</scope>
        <flags>128</flags>
        <owner>static</owner>
      </assigned-address>
      <assigned-address>
        <local>2001:db8::10/128</local>                                                         <--- fixed
        <peer>2001:db8::1</peer>                                                                <--- fixed
        <scope>universe</scope>
        <flags>128</flags>
        <owner>static</owner>
      </assigned-address>
      <assigned-address>
        <local>172.22.49.10/32</local>                                                          <--- fixed
        <peer>172.22.49.1</peer>                                                                <--- fixed
        <scope>universe</scope>
        <flags>128</flags>
        <label>eth4</label>
        <owner>static</owner>
      </assigned-address>
      <assigned-address>
        <local>172.22.49.11/24</local>
        <broadcast>172.22.49.255</broadcast>
        <scope>universe</scope>
        <flags>128</flags>
        <label>eth4</label>
        <owner>static</owner>
      </assigned-address>
      <assigned-address>
        <local>172.22.49.12/32</local>
        <scope>universe</scope>
        <flags>128</flags>
        <label>eth4</label>
        <owner>static</owner>
      </assigned-address>
    </addresses>
<!-- [...] -->

wicked ifdown eth4

eth4            device-ready

ip addr show dev eth4

5: eth4: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 00:1b:21:53:06:57 brd ff:ff:ff:ff:ff:ff
    altname enp7s0f1

the inet 172.22.49.10 peer 172.22.49.1/32 has been removed <--- fixed

journalctl -u wickedd.service -b | grep ni_rtnl_send_deladdr

no ni_rtnl_send_deladdr error <--- fixed

@mtomaschewski
Copy link
Member Author

The https://github.com/openSUSE/wicked/compare/1653700bb34a80e153acd8bff9313adab9252ea0..d3fa3575fe00c901ff85aa56f03237859f2c0061 changes are fixing checkpatch issues reported by the CI:

------------------------------------------------------------------------
Commit a26c45aca49e ("rtnl: pass ifname in newaddr parsing and logging")
------------------------------------------------------------------------
WARNING:LONG_LINE: line length of 122 exceeds 120 columns
#55: FILE: src/iflist.c:2830:
+__ni_rtnl_parse_newaddr(const char *ifname, unsigned ifflags, struct nlmsghdr *h, struct ifaddrmsg *ifa, ni_address_t *ap)

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#55: FILE: src/iflist.c:2830:
+__ni_rtnl_parse_newaddr(const char *ifname, unsigned ifflags, struct nlmsghdr *h, struct ifaddrmsg *ifa, ni_address_t *ap)

WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
#104: FILE: src/kernel.h:123:
+extern int	__ni_rtnl_parse_newaddr(const char *, unsigned, struct nlmsghdr *, struct ifaddrmsg *, ni_address_t *);

@mtomaschewski
Copy link
Member Author

JFYI: Test RPMs built by the CI are in https://download.opensuse.org/repositories/network:/wicked:/testing/

Copy link
Collaborator

@cfconrad cfconrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cfconrad cfconrad merged commit f9b3b0d into openSUSE:master Oct 18, 2023
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Feb 4, 2024
https://build.opensuse.org/request/show/1143605
by user wicked-maintainers + anag+factory
- ifreload: VLAN changes require device deletion (bsc#1218927)
  [+ 0009-ifreload-VLAN-changes-require-device-deletion-bsc-12.patch]
- ifcheck: fix config changed check (bsc#1218926)
  [+ 0008-ifcheck-fix-config-changed-check-bsc-1218926.patch]
- client: fix exit code for no-carrier status (bsc#1219265)
  [+ 0007-Fix-ifstatus-exit-code-for-NI_WICKED_ST_NO_CARRIER-s.patch]
- dhcp6: omit the SO_REUSEPORT option (bsc#1215692)
  [+ 0006-dhcp6-omit-the-SO_REUSEPORT-option-bsc-1215692.patch]
- duid: fix comment for v6time
  (openSUSE/wicked#989)
  [+ 0005-duid-fix-comment-for-v6time.patch]
- rtnl: fix peer address parsing for non ptp-interfaces
  (openSUSE/wicked#987,
  openSUSE/wicked#988)
  [+ 0003-rtnl-pass-ifname-in-newa
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Feb 7, 2024
https://build.opensuse.org/request/show/1143605
by user wicked-maintainers + anag+factory
- ifreload: VLAN changes require device deletion (bsc#1218927)
  [+ 0009-ifreload-VLAN-changes-require-device-deletion-bsc-12.patch]
- ifcheck: fix config changed check (bsc#1218926)
  [+ 0008-ifcheck-fix-config-changed-check-bsc-1218926.patch]
- client: fix exit code for no-carrier status (bsc#1219265)
  [+ 0007-Fix-ifstatus-exit-code-for-NI_WICKED_ST_NO_CARRIER-s.patch]
- dhcp6: omit the SO_REUSEPORT option (bsc#1215692)
  [+ 0006-dhcp6-omit-the-SO_REUSEPORT-option-bsc-1215692.patch]
- duid: fix comment for v6time
  (openSUSE/wicked#989)
  [+ 0005-duid-fix-comment-for-v6time.patch]
- rtnl: fix peer address parsing for non ptp-interfaces
  (openSUSE/wicked#987,
  openSUSE/wicked#988)
  [+ 0003-rtnl-pass-ifname-in-newa
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Feb 7, 2024
https://build.opensuse.org/request/show/1143605
by user wicked-maintainers + anag+factory
- ifreload: VLAN changes require device deletion (bsc#1218927)
  [+ 0009-ifreload-VLAN-changes-require-device-deletion-bsc-12.patch]
- ifcheck: fix config changed check (bsc#1218926)
  [+ 0008-ifcheck-fix-config-changed-check-bsc-1218926.patch]
- client: fix exit code for no-carrier status (bsc#1219265)
  [+ 0007-Fix-ifstatus-exit-code-for-NI_WICKED_ST_NO_CARRIER-s.patch]
- dhcp6: omit the SO_REUSEPORT option (bsc#1215692)
  [+ 0006-dhcp6-omit-the-SO_REUSEPORT-option-bsc-1215692.patch]
- duid: fix comment for v6time
  (openSUSE/wicked#989)
  [+ 0005-duid-fix-comment-for-v6time.patch]
- rtnl: fix peer address parsing for non ptp-interfaces
  (openSUSE/wicked#987,
  openSUSE/wicked#988)
  [+ 0003-rtnl-pass-ifname-in-newa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants