From: "Jason Donenfeld" <zx2c4@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/systemd/, sys-apps/systemd/files/
Date: Thu, 8 Feb 2018 17:17:53 +0000 (UTC) [thread overview]
Message-ID: <1518110238.701d8158f31d695a453704b1b8f8f03bda93a39f.zx2c4@gentoo> (raw)
commit: 701d8158f31d695a453704b1b8f8f03bda93a39f
Author: Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 8 17:16:49 2018 +0000
Commit: Jason Donenfeld <zx2c4 <AT> gentoo <DOT> org>
CommitDate: Thu Feb 8 17:17:18 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=701d8158
sys-apps/systemd: show proper networkctl display type
Upstream commit:
https://github.com/systemd/systemd/commit/3b8f29fd93899c4876a6ef53f9bcb6b40e1c98e7
Package-Manager: Portage-2.3.24, Repoman-2.3.6
.../files/237-0001-networkctl-display-type.patch | 266 +++++++++++++++++++++
...systemd-237-r1.ebuild => systemd-237-r2.ebuild} | 1 +
2 files changed, 267 insertions(+)
diff --git a/sys-apps/systemd/files/237-0001-networkctl-display-type.patch b/sys-apps/systemd/files/237-0001-networkctl-display-type.patch
new file mode 100644
index 00000000000..e29cf2206aa
--- /dev/null
+++ b/sys-apps/systemd/files/237-0001-networkctl-display-type.patch
@@ -0,0 +1,266 @@
+From a18461bc7d446f8e130e9276de4397d00059267f Mon Sep 17 00:00:00 2001
+From: "Jason A. Donenfeld" <Jason@zx2c4.com>
+Date: Mon, 29 Jan 2018 20:58:24 +0100
+Subject: [PATCH 1/4] networkd: display wireguard devtype
+
+It's not useful to simply show "none", when we have more interesting
+information to display.
+
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+---
+ src/network/networkctl.c | 22 +++++++++++++++-------
+ 1 file changed, 15 insertions(+), 7 deletions(-)
+
+diff --git a/src/network/networkctl.c b/src/network/networkctl.c
+index 59ce098cd1..6ce00dff6d 100644
+--- a/src/network/networkctl.c
++++ b/src/network/networkctl.c
+@@ -62,18 +62,26 @@ static int link_get_type_string(unsigned short iftype, sd_device *d, char **ret)
+
+ assert(ret);
+
+- if (iftype == ARPHRD_ETHER && d) {
++ if (d) {
+ const char *devtype = NULL, *id = NULL;
++
++ (void) sd_device_get_devtype(d, &devtype);
++
+ /* WLANs have iftype ARPHRD_ETHER, but we want
+ * to show a more useful type string for
+ * them */
++ if (iftype == ARPHRD_ETHER) {
++ if (streq_ptr(devtype, "wlan"))
++ id = "wlan";
++ else if (streq_ptr(devtype, "wwan"))
++ id = "wwan";
++ }
+
+- (void) sd_device_get_devtype(d, &devtype);
+-
+- if (streq_ptr(devtype, "wlan"))
+- id = "wlan";
+- else if (streq_ptr(devtype, "wwan"))
+- id = "wwan";
++ /* Likewise, WireGuard has iftype ARPHRD_NONE,
++ * since it's layer 3, but we of course want
++ * something more useful than that. */
++ if (iftype == ARPHRD_NONE && streq_ptr(devtype, "wireguard"))
++ id = "wireguard";
+
+ if (id) {
+ p = strdup(id);
+
+From f119082e7a1ccfbf50c30a99819b6e303cdf09a1 Mon Sep 17 00:00:00 2001
+From: "Jason A. Donenfeld" <Jason@zx2c4.com>
+Date: Mon, 29 Jan 2018 21:01:46 +0100
+Subject: [PATCH 2/4] networkd: simplify and display all devtypes
+
+Every place the kernel actually calls SET_NETDEV_DEVTYPE, it's adding a
+piece of information that looks useful and relevant for us to use. So
+let's use it when it's there.
+
+The previous matching based on the corresponding ARPHRD didn't really
+make much sense. The more sensible logic for getting a textual
+representation of the link type is to see if the kernel supplies a
+devtype. If it does, great. If not, then we can fall back on the ARPHRD,
+as before.
+
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+---
+ src/network/networkctl.c | 23 +++--------------------
+ 1 file changed, 3 insertions(+), 20 deletions(-)
+
+diff --git a/src/network/networkctl.c b/src/network/networkctl.c
+index 6ce00dff6d..8a08304240 100644
+--- a/src/network/networkctl.c
++++ b/src/network/networkctl.c
+@@ -63,28 +63,11 @@ static int link_get_type_string(unsigned short iftype, sd_device *d, char **ret)
+ assert(ret);
+
+ if (d) {
+- const char *devtype = NULL, *id = NULL;
++ const char *devtype = NULL;
+
+ (void) sd_device_get_devtype(d, &devtype);
+-
+- /* WLANs have iftype ARPHRD_ETHER, but we want
+- * to show a more useful type string for
+- * them */
+- if (iftype == ARPHRD_ETHER) {
+- if (streq_ptr(devtype, "wlan"))
+- id = "wlan";
+- else if (streq_ptr(devtype, "wwan"))
+- id = "wwan";
+- }
+-
+- /* Likewise, WireGuard has iftype ARPHRD_NONE,
+- * since it's layer 3, but we of course want
+- * something more useful than that. */
+- if (iftype == ARPHRD_NONE && streq_ptr(devtype, "wireguard"))
+- id = "wireguard";
+-
+- if (id) {
+- p = strdup(id);
++ if (!isempty(devtype)) {
++ p = strdup(devtype);
+ if (!p)
+ return -ENOMEM;
+
+
+From fdce7817b9a27a370c01b7dd9da6a84fcae1038e Mon Sep 17 00:00:00 2001
+From: "Jason A. Donenfeld" <Jason@zx2c4.com>
+Date: Mon, 29 Jan 2018 21:05:36 +0100
+Subject: [PATCH 3/4] networkd: clean up link_get_type_string
+
+The return value is always ignored, so get rid of it.
+
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+---
+ src/network/networkctl.c | 16 +++++++---------
+ 1 file changed, 7 insertions(+), 9 deletions(-)
+
+diff --git a/src/network/networkctl.c b/src/network/networkctl.c
+index 8a08304240..7b33e0db17 100644
+--- a/src/network/networkctl.c
++++ b/src/network/networkctl.c
+@@ -56,7 +56,7 @@ static bool arg_no_pager = false;
+ static bool arg_legend = true;
+ static bool arg_all = false;
+
+-static int link_get_type_string(unsigned short iftype, sd_device *d, char **ret) {
++static void link_get_type_string(unsigned short iftype, sd_device *d, char **ret) {
+ const char *t;
+ char *p;
+
+@@ -69,27 +69,25 @@ static int link_get_type_string(unsigned short iftype, sd_device *d, char **ret)
+ if (!isempty(devtype)) {
+ p = strdup(devtype);
+ if (!p)
+- return -ENOMEM;
++ return;
+
+ *ret = p;
+- return 1;
++ return;
+ }
+ }
+
+ t = arphrd_to_name(iftype);
+ if (!t) {
+ *ret = NULL;
+- return 0;
++ return;
+ }
+
+ p = strdup(t);
+ if (!p)
+- return -ENOMEM;
++ return;
+
+ ascii_strlower(p);
+ *ret = p;
+-
+- return 0;
+ }
+
+ static void operational_state_to_color(const char *state, const char **on, const char **off) {
+@@ -314,7 +312,7 @@ static int list_links(int argc, char *argv[], void *userdata) {
+ xsprintf(devid, "n%i", links[i].ifindex);
+ (void) sd_device_new_from_device_id(&d, devid);
+
+- (void) link_get_type_string(links[i].iftype, d, &t);
++ link_get_type_string(links[i].iftype, d, &t);
+
+ printf("%3i %-16s %-18s %s%-11s%s %s%-10s%s\n",
+ links[i].ifindex, links[i].name, strna(t),
+@@ -807,7 +805,7 @@ static int link_status_one(
+ (void) sd_device_get_property_value(d, "ID_MODEL", &model);
+ }
+
+- (void) link_get_type_string(info->iftype, d, &t);
++ link_get_type_string(info->iftype, d, &t);
+
+ (void) sd_network_link_get_network_file(info->ifindex, &network);
+
+
+From b55822c349d3e0559c1efc7475fd0f74cf086453 Mon Sep 17 00:00:00 2001
+From: "Jason A. Donenfeld" <Jason@zx2c4.com>
+Date: Mon, 29 Jan 2018 21:08:39 +0100
+Subject: [PATCH 4/4] networkd: clean up link_get_type_string returns
+
+It's cleaner and more consistent to actually return what we were
+planning on returning.
+
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+---
+ src/network/networkctl.c | 28 +++++++++-------------------
+ 1 file changed, 9 insertions(+), 19 deletions(-)
+
+diff --git a/src/network/networkctl.c b/src/network/networkctl.c
+index 7b33e0db17..14d8ecb03f 100644
+--- a/src/network/networkctl.c
++++ b/src/network/networkctl.c
+@@ -56,38 +56,28 @@ static bool arg_no_pager = false;
+ static bool arg_legend = true;
+ static bool arg_all = false;
+
+-static void link_get_type_string(unsigned short iftype, sd_device *d, char **ret) {
++static char *link_get_type_string(unsigned short iftype, sd_device *d) {
+ const char *t;
+ char *p;
+
+- assert(ret);
+-
+ if (d) {
+ const char *devtype = NULL;
+
+ (void) sd_device_get_devtype(d, &devtype);
+- if (!isempty(devtype)) {
+- p = strdup(devtype);
+- if (!p)
+- return;
+-
+- *ret = p;
+- return;
+- }
++ if (!isempty(devtype))
++ return strdup(devtype);
+ }
+
+ t = arphrd_to_name(iftype);
+- if (!t) {
+- *ret = NULL;
+- return;
+- }
++ if (!t)
++ return NULL;
+
+ p = strdup(t);
+ if (!p)
+- return;
++ return NULL;
+
+ ascii_strlower(p);
+- *ret = p;
++ return p;
+ }
+
+ static void operational_state_to_color(const char *state, const char **on, const char **off) {
+@@ -312,7 +302,7 @@ static int list_links(int argc, char *argv[], void *userdata) {
+ xsprintf(devid, "n%i", links[i].ifindex);
+ (void) sd_device_new_from_device_id(&d, devid);
+
+- link_get_type_string(links[i].iftype, d, &t);
++ t = link_get_type_string(links[i].iftype, d);
+
+ printf("%3i %-16s %-18s %s%-11s%s %s%-10s%s\n",
+ links[i].ifindex, links[i].name, strna(t),
+@@ -805,7 +795,7 @@ static int link_status_one(
+ (void) sd_device_get_property_value(d, "ID_MODEL", &model);
+ }
+
+- link_get_type_string(info->iftype, d, &t);
++ t = link_get_type_string(info->iftype, d);
+
+ (void) sd_network_link_get_network_file(info->ifindex, &network);
+
diff --git a/sys-apps/systemd/systemd-237-r1.ebuild b/sys-apps/systemd/systemd-237-r2.ebuild
similarity index 99%
rename from sys-apps/systemd/systemd-237-r1.ebuild
rename to sys-apps/systemd/systemd-237-r2.ebuild
index 97ed32eebe7..71abd1c3359 100644
--- a/sys-apps/systemd/systemd-237-r1.ebuild
+++ b/sys-apps/systemd/systemd-237-r2.ebuild
@@ -148,6 +148,7 @@ src_unpack() {
src_prepare() {
local PATCHES=(
+ "${FILESDIR}/237-0001-networkctl-display-type.patch"
)
[[ -d "${WORKDIR}"/patches ]] && PATCHES+=( "${WORKDIR}"/patches )
next reply other threads:[~2018-02-08 17:17 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-08 17:17 Jason Donenfeld [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-05-28 0:51 [gentoo-commits] repo/gentoo:master commit in: sys-apps/systemd/, sys-apps/systemd/files/ Sam James
2024-05-05 15:43 Sam James
2024-04-18 4:20 Mike Gilbert
2024-03-04 2:51 Sam James
2024-02-24 15:51 Mike Gilbert
2023-12-24 11:58 Sam James
2023-12-12 2:50 Sam James
2023-08-17 1:08 Mike Gilbert
2023-08-05 23:07 Sam James
2023-08-02 21:14 Sam James
2023-07-27 22:55 Sam James
2023-02-26 19:27 Mike Gilbert
2022-11-07 16:15 Mike Gilbert
2022-10-19 18:13 Mike Gilbert
2022-05-21 22:23 Mike Gilbert
2022-03-25 4:56 Sam James
2021-12-25 18:20 Mike Gilbert
2021-12-09 19:40 Mike Gilbert
2021-11-14 23:53 Mike Gilbert
2021-11-07 5:27 Georgy Yakovlev
2021-09-14 23:47 Mike Gilbert
2021-09-08 18:29 Mike Gilbert
2021-09-08 18:29 Mike Gilbert
2021-07-08 20:23 Mike Gilbert
2021-06-20 17:18 Mike Gilbert
2021-05-19 19:37 Mike Gilbert
2020-11-08 17:51 Mike Gilbert
2020-05-21 0:13 Mike Gilbert
2020-04-27 14:41 Mike Gilbert
2020-04-17 16:36 Mike Gilbert
2020-02-06 15:24 Mike Gilbert
2020-02-05 18:24 Mike Gilbert
2019-11-17 19:56 Mike Gilbert
2019-08-11 16:28 Mike Gilbert
2019-07-10 18:21 Mike Gilbert
2019-07-10 15:37 Mike Gilbert
2019-07-08 15:47 Mike Gilbert
2019-06-08 20:44 Mike Gilbert
2019-02-18 23:32 Mike Gilbert
2018-12-26 4:02 Mike Gilbert
2018-05-24 20:33 Mike Gilbert
2018-04-18 16:50 Mike Gilbert
2018-04-05 20:12 Mike Gilbert
2018-04-01 16:31 Mike Gilbert
2018-04-01 16:31 Mike Gilbert
2018-03-26 21:17 Mike Gilbert
2018-03-10 17:29 Mike Gilbert
2017-12-19 2:01 Mike Gilbert
2017-12-17 19:03 Mike Gilbert
2017-11-19 20:09 Mike Gilbert
2017-10-26 21:37 Mike Gilbert
2017-10-08 14:40 Mike Gilbert
2017-08-13 23:08 Mike Gilbert
2017-07-17 15:28 Mike Gilbert
2017-07-02 15:56 Mike Gilbert
2017-06-28 20:31 Mike Gilbert
2017-01-10 22:22 Mike Gilbert
2017-01-10 22:22 Mike Gilbert
2016-11-04 1:06 Mike Gilbert
2016-10-30 3:52 Mike Gilbert
2016-04-10 1:05 Mike Gilbert
2015-09-26 1:53 Mike Gilbert
2015-09-25 14:52 Mike Gilbert
2015-08-22 17:16 Mike Gilbert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1518110238.701d8158f31d695a453704b1b8f8f03bda93a39f.zx2c4@gentoo \
--to=zx2c4@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox