Skip to content

network: improve debug logs and add tests for IPv4LL#17798

Merged
keszybz merged 6 commits intosystemd:masterfrom
yuwata:ipv4ll-follow-ups
Dec 2, 2020
Merged

network: improve debug logs and add tests for IPv4LL#17798
keszybz merged 6 commits intosystemd:masterfrom
yuwata:ipv4ll-follow-ups

Conversation

@yuwata
Copy link
Copy Markdown
Member

@yuwata yuwata commented Dec 2, 2020

No description provided.

@yuwata
Copy link
Copy Markdown
Member Author

yuwata commented Dec 2, 2020

@keszybz
#17692 (comment)

I.e. the LL address will remain forever. Shouldn't we mark it non-preferred and drop after a minute or so?

I cannot find that behavior. The IPv4LL address is dropped soon after DHCPv4 address becomes ready. I've added a test to confirm that. PTAL.

@yuwata yuwata force-pushed the ipv4ll-follow-ups branch from f57d874 to 0430b6f Compare December 2, 2020 08:46
Copy link
Copy Markdown
Member

@keszybz keszybz left a comment

Choose a reason for hiding this comment

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

LGTM, except for the double-eval thing. It doesn't matter for the current usage, but I think it'd be nicer to avoid the issue to avoid bugs in the future.

I'm not sure why I saw different behaviour in my local test. I'll retest after all outstanding PRs have been merged.

}

int sd_ipv4acd_get_ifindex(sd_ipv4acd *acd) {
assert_return(acd, -EINVAL);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

EBADF?

Maybe make this not assert_return but silent? See comments below...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

EBADF?? At least under libsystemd-network, we do not use EBADF...

#define log_ipv4acd_errno(acd, error, fmt, ...) log_internal(LOG_DEBUG, error, PROJECT_FILE, __LINE__, __func__, "IPV4ACD: " fmt, ##__VA_ARGS__)
#define log_ipv4acd(acd, fmt, ...) log_ipv4acd_errno(acd, 0, fmt, ##__VA_ARGS__)
#define log_ipv4acd_errno(acd, error, fmt, ...) \
log_interface_full_errno(acd ? sd_ipv4acd_get_ifname(acd) : NULL, LOG_DEBUG, error, "IPV4ACD: " fmt, ##__VA_ARGS__)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unfortunately this does double evaluation of acd. So maybe make sd_ipv4acd_get_ifname() just return NULL if the argument is NULL without complaining?

#define log_ipv4ll_errno(ll, error, fmt, ...) log_internal(LOG_DEBUG, error, PROJECT_FILE, __LINE__, __func__, "IPV4LL: " fmt, ##__VA_ARGS__)
#define log_ipv4ll(ll, fmt, ...) log_ipv4ll_errno(ll, 0, fmt, ##__VA_ARGS__)
#define log_ipv4ll_errno(ll, error, fmt, ...) \
log_interface_full_errno((ll && ll->acd) ? sd_ipv4acd_get_ifname(ll->acd) : NULL, LOG_DEBUG, error, "IPV4LL: " fmt, ##__VA_ARGS__)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here.

self.assertRegex(output, 'inet 192.168.5.[0-9]*/24 brd 192.168.5.255 scope global dynamic veth99')
output = check_output('ip -4 address show dev veth99 scope link')
self.assertNotRegex(output, 'inet .* scope link')
self.assertNotRegex(output, 'inet 169.254.[0-9]*.[0-9]*/16 brd 169.254.255.255 scope link')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not that it matters, but maybe:

r'inet 169\.254\.\d+\.\d+/16 brd 169.254.255.255 scope link'

if (!a)
return 0;


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Double newline.

@keszybz keszybz added the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Dec 2, 2020
@yuwata yuwata force-pushed the ipv4ll-follow-ups branch from 0430b6f to 5f016e3 Compare December 2, 2020 09:52
@yuwata
Copy link
Copy Markdown
Member Author

yuwata commented Dec 2, 2020

@keszybz Thank you for the review. All points except EBADF thing are addressed. PTAL.

@keszybz
Copy link
Copy Markdown
Member

keszybz commented Dec 2, 2020

LGTM.

@keszybz keszybz added good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed and removed reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks labels Dec 2, 2020
@keszybz
Copy link
Copy Markdown
Member

keszybz commented Dec 2, 2020

bionic-s390x failed in timedated test, looks unrelated.

@keszybz
Copy link
Copy Markdown
Member

keszybz commented Dec 2, 2020

bionic-* is failing in timedated test (same as other PRs).

@keszybz keszybz added ci-failure-appears-unrelated and removed good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed labels Dec 2, 2020
@keszybz keszybz merged commit efbbdf2 into systemd:master Dec 2, 2020
@yuwata yuwata deleted the ipv4ll-follow-ups branch December 2, 2020 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants