[ovs-dev] [PATCH 1/3] ovs-ctl: fallback to "uname -n" for fetching hostname

Yousong Zhou yszhou4tech at gmail.com
Fri Nov 30 07:30:02 UTC 2018


From: Yousong Zhou <yszhou4tech at gmail.com>

The command "hostname" is not available in OpenWrt by default.  Strace
result of hostname-3.13 on centos7 shows that bare "hostname" command
calls uname() to fetch node name.

Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 utilities/ovs-ctl.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index e42f0f1e6..7f2b17b06 100644
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -40,7 +40,7 @@ set_hostname () {
     # call this only after ovs-vswitchd is running.
     hn="$(hostname -f)"
     if test X$FULL_HOSTNAME = Xno; then
-        hn="$(hostname)"
+        hn="$(uname -n)"
     fi
     ovs_vsctl set Open_vSwitch . external-ids:hostname="$hn"
 }


More information about the dev mailing list