Hello community,

here is the log from the commit of package wpan-tools for openSUSE:Factory 
checked in at 2019-08-27 10:18:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/wpan-tools (Old)
 and      /work/SRC/openSUSE:Factory/.wpan-tools.new.7948 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "wpan-tools"

Tue Aug 27 10:18:37 2019 rev:2 rq:725831 version:0.9

Changes:
--------
--- /work/SRC/openSUSE:Factory/wpan-tools/wpan-tools.changes    2018-10-22 
11:25:18.131038832 +0200
+++ /work/SRC/openSUSE:Factory/.wpan-tools.new.7948/wpan-tools.changes  
2019-08-27 10:18:42.775950250 +0200
@@ -1,0 +2,8 @@
+Sat Aug 24 15:31:16 UTC 2019 - Jan Engelhardt <[email protected]>
+
+- Update to new upstream release 0.9
+  * The big feature in this release is a configuration utility for
+    hwsim, a hardware simulation driver which landed mainline in
+    the 4.19 kernel release.
+
+-------------------------------------------------------------------

Old:
----
  wpan-tools-0.8.tar.xz

New:
----
  wpan-tools-0.9.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ wpan-tools.spec ++++++
--- /var/tmp/diff_new_pack.KKF509/_old  2019-08-27 10:18:43.287950216 +0200
+++ /var/tmp/diff_new_pack.KKF509/_new  2019-08-27 10:18:43.291950215 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package wpan-tools
 #
-# Copyright (c) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,19 +12,18 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           wpan-tools
 Summary:        Utilities to manage the Linux 802.15.4 WPAN stack
-Version:        0.8
-Release:        0
 License:        ISC
 Group:          Hardware/Wifi
-Url:            https://github.com/linux-wpan/wpan-tools
+Version:        0.9
+Release:        0
+URL:            https://github.com/linux-wpan/wpan-tools
 Source:         
https://github.com/linux-wpan/wpan-tools/releases/download/%name-%version/%name-%version.tar.xz
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  bison
 BuildRequires:  flex
 BuildRequires:  help2man
@@ -48,10 +47,8 @@
 %make_install
 
 %files
-%defattr(-,root,root)
-%_bindir/af*
 %_bindir/iwpan
-%_bindir/wpan-ping
+%_bindir/wpan*
 %license COPYING
 
 %changelog

++++++ wpan-tools-0.8.tar.xz -> wpan-tools-0.9.tar.xz ++++++
++++ 2215 lines of diff (skipped)
++++    retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/wpan-tools-0.8/Makefile.am new/wpan-tools-0.9/Makefile.am
--- old/wpan-tools-0.8/Makefile.am      2016-11-25 11:36:47.027645686 +0100
+++ new/wpan-tools-0.9/Makefile.am      2018-11-29 12:41:46.981314443 +0100
@@ -21,4 +21,5 @@
 SUBDIRS = \
        src \
        wpan-ping \
+       wpan-hwsim \
        examples
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/wpan-tools-0.8/build-aux/compile new/wpan-tools-0.9/build-aux/compile
--- old/wpan-tools-0.8/build-aux/compile        2017-02-10 07:47:11.000000000 
+0100
+++ new/wpan-tools-0.9/build-aux/compile        2018-02-09 09:27:34.000000000 
+0100
@@ -1,9 +1,9 @@
-#! /bin/sh
+#!/bin/sh
 # Wrapper for compilers which do not understand '-c -o'.
 
-scriptversion=2012-10-14.11; # UTC
+scriptversion=2016-01-11.22; # UTC
 
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
 # Written by Tom Tromey <[email protected]>.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -255,7 +255,8 @@
     echo "compile $scriptversion"
     exit $?
     ;;
-  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
+  icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
     func_cl_wrapper "$@"      # Doesn't return...
     ;;
 esac
@@ -342,6 +343,6 @@
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/wpan-tools-0.8/build-aux/missing new/wpan-tools-0.9/build-aux/missing
--- old/wpan-tools-0.8/build-aux/missing        2017-02-10 07:47:11.000000000 
+0100
+++ new/wpan-tools-0.9/build-aux/missing        2018-02-09 09:27:34.000000000 
+0100
@@ -1,9 +1,9 @@
-#! /bin/sh
+#!/bin/sh
 # Common wrapper for a few potentially missing GNU programs.
 
-scriptversion=2013-10-28.13; # UTC
+scriptversion=2016-01-11.22; # UTC
 
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
 # Originally written by Fran,cois Pinard <[email protected]>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
@@ -210,6 +210,6 @@
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/wpan-tools-0.8/configure.ac new/wpan-tools-0.9/configure.ac
--- old/wpan-tools-0.8/configure.ac     2018-02-01 09:47:42.865850401 +0100
+++ new/wpan-tools-0.9/configure.ac     2018-12-19 15:07:41.496614621 +0100
@@ -1,6 +1,6 @@
 AC_PREREQ(2.60)
 AC_INIT([Userspace tools for Linux IEEE 802.15.4 stack],
-       [0.8], [[email protected]], [wpan-tools],
+       [0.9], [[email protected]], [wpan-tools],
        [https://github.com/linux-wpan/wpan-tools])
 AC_CONFIG_SRCDIR([src/iwpan.c])
 AC_CONFIG_AUX_DIR([build-aux])
@@ -56,6 +56,7 @@
         Makefile
        src/Makefile
        wpan-ping/Makefile
+       wpan-hwsim/Makefile
        examples/Makefile
 ])
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/wpan-tools-0.8/examples/Makefile.am new/wpan-tools-0.9/examples/Makefile.am
--- old/wpan-tools-0.8/examples/Makefile.am     2016-11-25 11:36:47.027645686 
+0100
+++ new/wpan-tools-0.9/examples/Makefile.am     2018-11-29 12:41:46.981314443 
+0100
@@ -1,8 +1,8 @@
-bin_PROGRAMS = af_ieee802154_tx \
-              af_ieee802154_rx \
-              af_packet_tx \
-              af_packet_rx \
-              af_inet6_tx \
-              af_inet6_rx
+noinst_PROGRAMS = af_ieee802154_tx \
+                 af_ieee802154_rx \
+                 af_packet_tx \
+                 af_packet_rx \
+                 af_inet6_tx \
+                 af_inet6_rx
 
 EXTRA_DIST = README.examples
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/wpan-tools-0.8/examples/TODO new/wpan-tools-0.9/examples/TODO
--- old/wpan-tools-0.8/examples/TODO    1970-01-01 01:00:00.000000000 +0100
+++ new/wpan-tools-0.9/examples/TODO    2016-11-21 16:35:46.688075410 +0100
@@ -0,0 +1,12 @@
+o ioctls: SIOCGIFADDR, SIOCSIFADDR, SIOCGSTAMP, SIOCGSTAMPNS
+
+o Get source/destination lladdr from UDP packet
+
+No examples for:
+o AF_IEEE802154 (SOCK_RAW)
+o AF_INET6 (SOCK_STREAM)
+
+TODO:
+o SOCK_RDM (Provides a reliable datagram layer that does not guarantee 
ordering)
+can we consider this with frame retries enabled???
+o Remove AF_IEEE802154 SOCK_RAW?? Does AF_PACKET cover all our needs here??
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/wpan-tools-0.8/examples/af_ieee802154_tx.c 
new/wpan-tools-0.9/examples/af_ieee802154_tx.c
--- old/wpan-tools-0.8/examples/af_ieee802154_tx.c      2016-11-25 
11:36:47.028645677 +0100
+++ new/wpan-tools-0.9/examples/af_ieee802154_tx.c      2018-12-19 
14:32:21.083327806 +0100
@@ -55,7 +55,7 @@
        int sd;
        ssize_t len;
        struct sockaddr_ieee802154 dst;
-       unsigned char buf[MAX_PACKET_LEN + 1];
+       char buf[MAX_PACKET_LEN + 1];
        /* IEEE 802.15.4 extended send address, adapt to your setup */
        uint8_t long_addr[IEEE802154_ADDR_LEN] = {0xd6, 0x55, 0x2c, 0xd6, 0xe4, 
0x1c, 0xeb, 0x57};
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/wpan-tools-0.8/examples/af_inet6_tx.c 
new/wpan-tools-0.9/examples/af_inet6_tx.c
--- old/wpan-tools-0.8/examples/af_inet6_tx.c   2016-11-25 11:36:47.028645677 
+0100
+++ new/wpan-tools-0.9/examples/af_inet6_tx.c   2018-12-19 14:32:21.083327806 
+0100
@@ -35,7 +35,7 @@
        int ret, sd;
        struct sockaddr_in6 dst;
        struct ifreq ifr;
-       unsigned char buf[MAX_PACKET_LEN + 1];
+       char buf[MAX_PACKET_LEN + 1];
 
        /* Create IPv6 address family socket for the SOCK_DGRAM type */
        sd = socket(PF_INET6, SOCK_DGRAM, 0);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/wpan-tools-0.8/src/iwpan.c new/wpan-tools-0.9/src/iwpan.c
--- old/wpan-tools-0.8/src/iwpan.c      2016-11-25 11:32:40.301866905 +0100
+++ new/wpan-tools-0.9/src/iwpan.c      2018-12-19 14:32:21.085327820 +0100
@@ -466,7 +466,7 @@
        int err;
 
        /* calculate command size including padding */
-       cmd_size = abs((long)&__section_set - (long)&__section_get);
+       cmd_size = labs((long)&__section_set - (long)&__section_get);
        /* strip off self */
        argc--;
        argv0 = *argv++;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/wpan-tools-0.8/wpan-hwsim/Makefile.am 
new/wpan-tools-0.9/wpan-hwsim/Makefile.am
--- old/wpan-tools-0.8/wpan-hwsim/Makefile.am   1970-01-01 01:00:00.000000000 
+0100
+++ new/wpan-tools-0.9/wpan-hwsim/Makefile.am   2018-12-19 15:03:13.759668542 
+0100
@@ -0,0 +1,7 @@
+bin_PROGRAMS = wpan-hwsim
+
+wpan_hwsim_SOURCES = wpan-hwsim.c \
+                    mac802154_hwsim.h
+
+wpan_hwsim_CFLAGS = $(AM_CFLAGS) $(LIBNL3_CFLAGS)
+wpan_hwsim_LDADD = $(LIBNL3_LIBS)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/wpan-tools-0.8/wpan-hwsim/mac802154_hwsim.h 
new/wpan-tools-0.9/wpan-hwsim/mac802154_hwsim.h
--- old/wpan-tools-0.8/wpan-hwsim/mac802154_hwsim.h     1970-01-01 
01:00:00.000000000 +0100
+++ new/wpan-tools-0.9/wpan-hwsim/mac802154_hwsim.h     2018-11-29 
12:41:46.990314506 +0100
@@ -0,0 +1,73 @@
+#ifndef __MAC802154_HWSIM_H
+#define __MAC802154_HWSIM_H
+
+/* mac802154 hwsim netlink commands
+ *
+ * @MAC802154_HWSIM_CMD_UNSPEC: unspecified command to catch error
+ * @MAC802154_HWSIM_CMD_GET_RADIO: fetch information about existing radios
+ * @MAC802154_HWSIM_CMD_SET_RADIO: change radio parameters during runtime
+ * @MAC802154_HWSIM_CMD_NEW_RADIO: create a new radio with the given parameters
+ *     returns the radio ID (>= 0) or negative on errors, if successful
+ *     then multicast the result
+ * @MAC802154_HWSIM_CMD_DEL_RADIO: destroy a radio, reply is multicasted
+ * @MAC802154_HWSIM_CMD_GET_EDGE: fetch information about existing edges
+ * @MAC802154_HWSIM_CMD_SET_EDGE: change edge parameters during runtime
+ * @MAC802154_HWSIM_CMD_DEL_EDGE: delete edges between radios
+ * @MAC802154_HWSIM_CMD_NEW_EDGE: create a new edge between two radios
+ * @__MAC802154_HWSIM_CMD_MAX: enum limit
+ */
+enum {
+       MAC802154_HWSIM_CMD_UNSPEC,
+
+       MAC802154_HWSIM_CMD_GET_RADIO,
+       MAC802154_HWSIM_CMD_SET_RADIO,
+       MAC802154_HWSIM_CMD_NEW_RADIO,
+       MAC802154_HWSIM_CMD_DEL_RADIO,
+
+       MAC802154_HWSIM_CMD_GET_EDGE,
+       MAC802154_HWSIM_CMD_SET_EDGE,
+       MAC802154_HWSIM_CMD_DEL_EDGE,
+       MAC802154_HWSIM_CMD_NEW_EDGE,
+
+       __MAC802154_HWSIM_CMD_MAX,
+};
+
+#define MAC802154_HWSIM_CMD_MAX (__MAC802154_HWSIM_MAX - 1)
+
+/* mac802154 hwsim netlink attributes
+ *
+ * @MAC802154_HWSIM_ATTR_UNSPEC: unspecified attribute to catch error
+ * @MAC802154_HWSIM_ATTR_RADIO_ID: u32 attribute to identify the radio
+ * @MAC802154_HWSIM_ATTR_EDGE: nested attribute of edges
+ * @MAC802154_HWSIM_ATTR_EDGES: list if nested attributes which contains the
+ *     edge information according the radio id
+ * @__MAC802154_HWSIM_ATTR_MAX: enum limit
+ */
+enum {
+       MAC802154_HWSIM_ATTR_UNSPEC,
+       MAC802154_HWSIM_ATTR_RADIO_ID,
+       MAC802154_HWSIM_ATTR_RADIO_EDGE,
+       MAC802154_HWSIM_ATTR_RADIO_EDGES,
+       __MAC802154_HWSIM_ATTR_MAX,
+};
+
+#define MAC802154_HWSIM_ATTR_MAX (__MAC802154_HWSIM_ATTR_MAX - 1)
+
+/* mac802154 hwsim edge netlink attributes
+ *
+ * @MAC802154_HWSIM_EDGE_ATTR_UNSPEC: unspecified attribute to catch error
+ * @MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID: radio id where the edge points to
+ * @MAC802154_HWSIM_EDGE_ATTR_LQI: LQI value which the endpoint radio will
+ *     receive for this edge
+ * @__MAC802154_HWSIM_ATTR_MAX: enum limit
+ */
+enum {
+       MAC802154_HWSIM_EDGE_ATTR_UNSPEC,
+       MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID,
+       MAC802154_HWSIM_EDGE_ATTR_LQI,
+       __MAC802154_HWSIM_EDGE_ATTR_MAX,
+};
+
+#define MAC802154_HWSIM_EDGE_ATTR_MAX (__MAC802154_HWSIM_EDGE_ATTR_MAX - 1)
+
+#endif /* __MAC802154_HWSIM_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/wpan-tools-0.8/wpan-hwsim/wpan-hwsim.c 
new/wpan-tools-0.9/wpan-hwsim/wpan-hwsim.c
--- old/wpan-tools-0.8/wpan-hwsim/wpan-hwsim.c  1970-01-01 01:00:00.000000000 
+0100
+++ new/wpan-tools-0.9/wpan-hwsim/wpan-hwsim.c  2018-12-06 20:32:11.349222591 
+0100
@@ -0,0 +1,510 @@
+/*
+ * Linux IEEE 802.15.4 hwsim tool
+ *
+ * Copyright (C) 2018 Alexander Aring <[email protected]>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <inttypes.h>
+#include <stdbool.h>
+#include <getopt.h>
+#include <stdint.h>
+#include <limits.h>
+#include <errno.h>
+#include <stdio.h>
+
+#include <netlink/netlink.h>
+
+#include <netlink/genl/genl.h>
+#include <netlink/genl/family.h>
+#include <netlink/genl/ctrl.h>
+
+#include "mac802154_hwsim.h"
+#include "config.h"
+
+static struct nl_sock *nl_sock;
+static int nlhwsim_id;
+
+static int nlhwsim_init(void)
+{
+       int err;
+
+       nl_sock = nl_socket_alloc();
+       if (!nl_sock) {
+               fprintf(stderr, "Failed to allocate netlink socket.\n");
+               return -ENOMEM;
+       }
+
+       nl_socket_set_buffer_size(nl_sock, 8192, 8192);
+
+       if (genl_connect(nl_sock)) {
+               fprintf(stderr, "Failed to connect to generic netlink.\n");
+               err = -ENOLINK;
+               goto out_handle_destroy;
+       }
+
+       nlhwsim_id = genl_ctrl_resolve(nl_sock, "MAC802154_HWSIM");
+       if (nlhwsim_id < 0) {
+               fprintf(stderr, "MAC802154_HWSIM not found.\n");
+               err = -ENOENT;
+               nl_close(nl_sock);
+               goto out_handle_destroy;
+       }
+
+       return 0;
+
+out_handle_destroy:
+       nl_socket_free(nl_sock);
+       return err;
+}
+
+static void nlhwsim_cleanup(void)
+{
+       nl_close(nl_sock);
+       nl_socket_free(nl_sock);
+}
+
+static int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err,
+                        void *arg)
+{
+       int *ret = arg;
+       *ret = err->error;
+       return NL_STOP;
+}
+
+static int hwsim_create(void)
+{
+       struct nl_msg *msg;
+       struct nl_cb *cb;
+       int idx = 0, ret;
+
+       cb = nl_cb_alloc(NL_CB_DEFAULT);
+       if (!cb)
+               return -ENOMEM;
+
+       msg = nlmsg_alloc();
+       if (!msg) {
+               nl_cb_put(cb);
+               return -ENOMEM;
+       }
+
+       genlmsg_put(msg, NL_AUTO_PORT, NL_AUTO_SEQ, nlhwsim_id, 0, 0,
+                   MAC802154_HWSIM_CMD_NEW_RADIO, 0);
+       ret = nl_send_auto(nl_sock, msg);
+       if (ret < 0) {
+               nl_cb_put(cb);
+               return ret;
+       }
+
+       nl_cb_err(cb, NL_CB_CUSTOM, error_handler, &idx);
+       nl_recvmsgs(nl_sock, cb);
+       printf("wpan_hwsim radio%d registered.\n", idx);
+
+       nl_cb_put(cb);
+
+       return 0;
+}
+
+static int nl_msg_dot_cb(struct nl_msg* msg, void* arg)
+{
+       static struct nla_policy edge_policy[MAC802154_HWSIM_EDGE_ATTR_MAX + 1] 
= {
+               [MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID] = { .type = NLA_U32 },
+               [MAC802154_HWSIM_EDGE_ATTR_LQI] = { .type = NLA_U8 },
+       };
+       struct nlmsghdr *nlh = nlmsg_hdr(msg);
+       struct genlmsghdr *gnlh = (struct genlmsghdr*) nlmsg_data(nlh);
+       struct nlattr *attrs[MAC802154_HWSIM_ATTR_MAX + 1];
+       struct nlattr *edge[MAC802154_HWSIM_EDGE_ATTR_MAX + 1];
+       unsigned int *ignore_idx = arg;
+       struct nlattr *nl_edge;
+       uint32_t idx, idx2;
+       uint8_t lqi = 0xff;
+       int rem_edge;
+       int rc;
+
+       nla_parse(attrs, MAC802154_HWSIM_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
+                 genlmsg_attrlen(gnlh, 0), NULL);
+
+       if (!attrs[MAC802154_HWSIM_ATTR_RADIO_ID])
+               return NL_SKIP;
+
+       idx = nla_get_u32(attrs[MAC802154_HWSIM_ATTR_RADIO_ID]);
+       if (idx == *ignore_idx)
+               return NL_SKIP;
+
+       if (!attrs[MAC802154_HWSIM_ATTR_RADIO_EDGES])
+               return NL_SKIP;
+
+       nla_for_each_nested(nl_edge, attrs[MAC802154_HWSIM_ATTR_RADIO_EDGES],
+                           rem_edge) {
+               rc = nla_parse_nested(edge, MAC802154_HWSIM_EDGE_ATTR_MAX,
+                                     nl_edge, edge_policy);
+               if (rc)
+                       return NL_SKIP;
+
+               idx2 = nla_get_u32(edge[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID]);
+               if (idx2 == *ignore_idx)
+                       continue;
+
+               lqi = nla_get_u32(edge[MAC802154_HWSIM_EDGE_ATTR_LQI]);
+               printf("\t%" PRIu32 " -> %" PRIu32 "[label=%" PRIu8 "];\n",
+                      idx, idx2, lqi);
+       }
+
+       return NL_SKIP;
+}
+
+static int nl_msg_cb(struct nl_msg* msg, void* arg)
+{
+       static struct nla_policy edge_policy[MAC802154_HWSIM_EDGE_ATTR_MAX + 1] 
= {
+               [MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID] = { .type = NLA_U32 },
+               [MAC802154_HWSIM_EDGE_ATTR_LQI] = { .type = NLA_U8 },
+       };
+       struct nlmsghdr *nlh = nlmsg_hdr(msg);
+       struct genlmsghdr *gnlh = (struct genlmsghdr*) nlmsg_data(nlh);
+       struct nlattr *attrs[MAC802154_HWSIM_ATTR_MAX + 1];
+       struct nlattr *edge[MAC802154_HWSIM_EDGE_ATTR_MAX + 1];
+       unsigned int *ignore_idx = arg;
+       struct nlattr *nl_edge;
+       uint32_t idx;
+       uint8_t lqi;
+       int rem_edge;
+       int rc;
+
+       nla_parse(attrs, MAC802154_HWSIM_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
+                 genlmsg_attrlen(gnlh, 0), NULL);
+
+       if (!attrs[MAC802154_HWSIM_ATTR_RADIO_ID])
+               return NL_SKIP;
+
+       idx = nla_get_u32(attrs[MAC802154_HWSIM_ATTR_RADIO_ID]);
+
+       if (idx == *ignore_idx)
+               return NL_SKIP;
+
+       printf("wpan_hwsim radio%" PRIu32 ":\n", idx);
+
+       if (!attrs[MAC802154_HWSIM_ATTR_RADIO_EDGES])
+               return NL_SKIP;
+
+       nla_for_each_nested(nl_edge, attrs[MAC802154_HWSIM_ATTR_RADIO_EDGES],
+                           rem_edge) {
+               rc = nla_parse_nested(edge, MAC802154_HWSIM_EDGE_ATTR_MAX,
+                                     nl_edge, edge_policy);
+               if (rc)
+                       return NL_SKIP;
+
+               idx = nla_get_u32(edge[MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID]);
+
+               if (idx == *ignore_idx)
+                       continue;
+
+               printf("\tedge:\n");
+               printf("\t\tradio%" PRIu32 "\n", idx);
+               lqi = nla_get_u32(edge[MAC802154_HWSIM_EDGE_ATTR_LQI]);
+               printf("\t\tlqi: 0x%02x\n", lqi);
+       }
+
+       return NL_SKIP;
+}
+
+static int hwsim_dump(bool dot, int unsigned ignore_idx)
+{
+       struct nl_msg *msg;
+       int rc;
+
+       nl_socket_modify_cb(nl_sock, NL_CB_VALID, NL_CB_CUSTOM,
+                           dot ? nl_msg_dot_cb : nl_msg_cb, &ignore_idx);
+       msg = nlmsg_alloc();
+       if (!msg)
+               return -ENOMEM;
+
+       genlmsg_put(msg, NL_AUTO_PORT, NL_AUTO_SEQ, nlhwsim_id, 0, NLM_F_DUMP,
+                   MAC802154_HWSIM_CMD_GET_RADIO, 0);
+
+       if (dot)
+               printf("digraph {\n");
+
+       rc = nl_send_sync(nl_sock, msg);
+       if (rc < 0)
+               return rc;
+
+       if (dot)
+               printf("}\n");
+
+       return rc;
+}
+
+static int hwsim_del(uint32_t idx)
+{
+       struct nl_msg *msg;
+       struct nl_cb *cb;
+       int err = 0;
+       int rc;
+
+       cb = nl_cb_alloc(NL_CB_DEFAULT);
+       if (!cb)
+               return -ENOMEM;
+
+       msg = nlmsg_alloc();
+       if (!msg) {
+               nl_cb_put(cb);
+               return -ENOMEM;
+       }
+
+       genlmsg_put(msg, NL_AUTO_PORT, NL_AUTO_SEQ, nlhwsim_id, 0, 0,
+                   MAC802154_HWSIM_CMD_DEL_RADIO, 0);
+       nla_put_u32(msg, MAC802154_HWSIM_ATTR_RADIO_ID, idx);
+
+       nl_cb_err(cb, NL_CB_CUSTOM, error_handler, &err);
+       rc = nl_send_auto(nl_sock, msg);
+       nl_recvmsgs(nl_sock, cb);
+       if (err < 0)
+               fprintf(stderr, "Failed to remove radio: %s\n", 
strerror(abs(err)));
+       nl_cb_put(cb);
+
+       return rc;
+}
+
+static int hwsim_cmd_edge(int cmd, uint32_t idx, uint32_t idx2, uint8_t lqi)
+{
+       struct nlattr* edge;
+       struct nl_msg *msg;
+       struct nl_cb *cb;
+       int err = 0;
+       int rc;
+
+       cb = nl_cb_alloc(NL_CB_DEFAULT);
+       if (!cb)
+               return -ENOMEM;
+
+       msg = nlmsg_alloc();
+       if (!msg) {
+               nl_cb_put(cb);
+               return -ENOMEM;
+       }
+
+       genlmsg_put(msg, NL_AUTO_PORT, NL_AUTO_SEQ, nlhwsim_id, 0, 0,
+                   cmd, 0);
+       nla_put_u32(msg, MAC802154_HWSIM_ATTR_RADIO_ID, idx);
+
+       edge = nla_nest_start(msg, MAC802154_HWSIM_ATTR_RADIO_EDGE);
+       if (!edge) {
+               nl_cb_put(cb);
+               return -ENOMEM;
+       }
+
+       nla_put_u32(msg, MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID, idx2);
+       if (cmd == MAC802154_HWSIM_CMD_SET_EDGE)
+               nla_put_u8(msg, MAC802154_HWSIM_EDGE_ATTR_LQI, lqi);
+
+       nla_nest_end(msg, edge);
+
+       nl_cb_err(cb, NL_CB_CUSTOM, error_handler, &err);
+       rc = nl_send_auto(nl_sock, msg);
+       nl_recvmsgs(nl_sock, cb);
+       if (err < 0)
+               fprintf(stderr, "Failed to add or remove edge: %s\n", 
strerror(abs(err)));
+       nl_cb_put(cb);
+
+       return rc;
+}
+
+static int hwsim_do_cmd(uint32_t cmd, unsigned int idx, unsigned int idx2,
+                       uint8_t lqi, bool dot, unsigned int ignore_idx)
+{
+       int rc;
+
+       rc = nlhwsim_init();
+       if (rc)
+               return 1;
+
+       switch (cmd) {
+       case MAC802154_HWSIM_CMD_GET_RADIO:
+               rc = hwsim_dump(dot, ignore_idx);
+               break;
+       case MAC802154_HWSIM_CMD_DEL_RADIO:
+               rc = hwsim_del(idx);
+               break;
+       case MAC802154_HWSIM_CMD_NEW_RADIO:
+               rc = hwsim_create();
+               break;
+       case MAC802154_HWSIM_CMD_NEW_EDGE:
+       case MAC802154_HWSIM_CMD_DEL_EDGE:
+       case MAC802154_HWSIM_CMD_SET_EDGE:
+               rc = hwsim_cmd_edge(cmd, idx, idx2, lqi);
+               break;
+       default:
+               rc = -EINVAL;
+               break;
+       }
+
+       nlhwsim_cleanup();
+
+       return rc;
+}
+
+static void print_usage(void)
+{
+       printf("wpan_hwsim [OPTION...] [CMD...]\n");
+       printf("\n");
+       printf(" possible options:\n");
+       printf("  -h, --help             show this help\n");
+       printf("  -v, --version          show version\n");
+       printf("  -d, --dot              dump topology as dot format\n");
+       printf("  -i, --ignore           filter one node from dump (useful for 
virtual monitors)\n");
+       printf("\n");
+       printf(" possible commands:\n");
+       printf("  add                    add new hwsim radio\n");
+       printf("  del IDX                del hwsim radio according idx\n");
+       printf("  edge add IDX IDX       add edge between radios\n");
+       printf("  edge del IDX IDX       delete edge between radios\n");
+       printf("  edge lqi IDX IDX LQI   set lqi value for a specific edge\n");
+       printf("\n");
+       printf("  To dump all node information just call this program without 
any command\n");
+}
+
+static void print_version(void)
+{
+       printf("wpan-hwsim " PACKAGE_VERSION "\n");
+}
+
+int main(int argc, const char *argv[])
+{
+       unsigned long int idx, idx2, lqi = 0, ignore_idx = ULONG_MAX;
+       bool dot = false;
+       int cmd;
+       int rc;
+       int c;
+
+       while (1) {
+               int option_index = 0;
+               static struct option long_options[] = {
+                       {"help",        no_argument,            0,      'h' },
+                       {"version",     no_argument,            0,      'v' },
+                       {"dot",         no_argument,            0,      'd' },
+                       {"ignore",      required_argument,      0,      'i' },
+                       {0,                             0,      0,      0 }
+               };
+
+               c = getopt_long(argc, (char **)argv, "vhdi:",
+                               long_options, &option_index);
+               if (c == -1)
+                       break;
+
+               switch (c) {
+               case 'v':
+                       print_version();
+                       return EXIT_SUCCESS;
+               case 'h':
+                       print_usage();
+                       return EXIT_SUCCESS;
+               case 'd':
+                       dot = true;
+                       break;
+               case 'i':
+                       ignore_idx = strtoul(optarg, NULL, 0);
+                       if (ignore_idx == ULONG_MAX) {
+                               fprintf(stderr, "Invalid radio index for ignore 
argument\n");
+                               return EXIT_FAILURE;
+                       }
+                       break;
+               default:
+                       print_usage();
+                       return EXIT_FAILURE;
+               }
+       }
+
+       if (optind + 1 > argc) {
+               rc = hwsim_do_cmd(MAC802154_HWSIM_CMD_GET_RADIO, 0, 0, 0, dot,
+                                 ignore_idx);
+               if (rc < 0)
+                       return EXIT_FAILURE;
+               else
+                       goto out;
+       }
+
+       if (!strncmp(argv[optind], "add", 3)) {
+               rc = hwsim_do_cmd(MAC802154_HWSIM_CMD_NEW_RADIO, 0, 0, 0, 0, 0);
+               if (rc < 0)
+                       return EXIT_FAILURE;
+       } else if (!strncmp(argv[optind], "del", 3)) {
+               if (optind + 2 > argc) {
+                       fprintf(stderr, "Missing radio index for delete\n");
+                       return EXIT_FAILURE;
+               } else {
+                       idx = strtoul(argv[optind + 1], NULL, 0);
+                       if (idx == ULONG_MAX) {
+                               fprintf(stderr, "Invalid radio index for 
delete\n");
+                               return EXIT_FAILURE;
+                       }
+
+                       rc = hwsim_do_cmd(MAC802154_HWSIM_CMD_DEL_RADIO, idx, 
0, 0, 0, 0);
+                       if (rc < 0)
+                               return EXIT_FAILURE;
+               }
+       } else if (!strncmp(argv[optind], "edge", 4)) {
+               if (optind + 4 > argc) {
+                       fprintf(stderr, "Missing edge radio index 
information\n");
+                       return EXIT_FAILURE;
+               } else {
+                       if (!strncmp(argv[optind + 1], "add", 3)) {
+                               cmd = MAC802154_HWSIM_CMD_NEW_EDGE;
+                       } else if (!strncmp(argv[optind + 1], "del", 3)) {
+                               cmd = MAC802154_HWSIM_CMD_DEL_EDGE;
+                       } else if (!strncmp(argv[optind + 1], "lqi", 3)) {
+                               cmd = MAC802154_HWSIM_CMD_SET_EDGE;
+                       } else {
+                               fprintf(stderr, "Invalid edge command\n");
+                               return EXIT_FAILURE;
+                       }
+
+                       if (cmd == MAC802154_HWSIM_CMD_SET_EDGE) {
+                               if (optind + 5 > argc) {
+                                       fprintf(stderr, "LQI information 
missing\n");
+                                       return EXIT_FAILURE;
+                               }
+
+                               lqi = strtoul(argv[optind + 4], NULL, 0);
+                               if (lqi == ULONG_MAX || lqi > 0xff) {
+                                       fprintf(stderr, "Invalid lqi value\n");
+                                       return EXIT_FAILURE;
+                               }
+                       }
+
+                       idx = strtoul(argv[optind + 2], NULL, 0);
+                       if (idx == ULONG_MAX) {
+                               fprintf(stderr, "Invalid first radio index for 
edge command\n");
+                               return EXIT_FAILURE;
+                       }
+
+                       idx2 = strtoul(argv[optind + 3], NULL, 0);
+                       if (idx2 == ULONG_MAX) {
+                               fprintf(stderr, "Invalid second radio index for 
edge command\n");
+                               return EXIT_FAILURE;
+                       }
+
+                       rc = hwsim_do_cmd(cmd, idx, idx2, lqi, 0, 0);
+                       if (rc < 0)
+                               return EXIT_FAILURE;
+               }
+       } else {
+               fprintf(stderr, "Unknown command\n");
+               print_usage();
+               return EXIT_FAILURE;
+       }
+
+out:
+       return EXIT_SUCCESS;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/wpan-tools-0.8/wpan-ping/wpan-ping.c 
new/wpan-tools-0.9/wpan-ping/wpan-ping.c
--- old/wpan-tools-0.8/wpan-ping/wpan-ping.c    2016-12-23 11:44:26.989737232 
+0100
+++ new/wpan-tools-0.9/wpan-ping/wpan-ping.c    2018-11-29 12:41:46.990314506 
+0100
@@ -194,7 +194,7 @@
        nl_socket_modify_cb(conf->nl_sock, NL_CB_VALID, NL_CB_CUSTOM, 
nl_msg_cb, conf);
        msg = nlmsg_alloc();
        genlmsg_put(msg, NL_AUTO_PORT, NL_AUTO_SEQ, conf->nl802154_id, 0, 
NLM_F_DUMP, NL802154_CMD_GET_INTERFACE, 0);
-       nla_put_string(msg, NL802154_ATTR_IFNAME, "conf->interface");
+       nla_put_string(msg, NL802154_ATTR_IFNAME, conf->interface);
        nl_send_sync(conf->nl_sock, msg);
 
        nl802154_cleanup(conf);


Reply via email to