* [ptxdist] [PATCH] lowpan-tools: update lowpan-patches
@ 2013-05-12 19:29 Alexander Aring
2013-05-13 7:42 ` Michael Olbrich
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Aring @ 2013-05-12 19:29 UTC (permalink / raw)
To: ptxdist; +Cc: Alexander Aring
Currently there is no way to make a new lowpan-tools release.
This patch synchronize the patches from version 0.3 with current
git master.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
.../0001-Avoid-crashing-in-izcoordinator.patch | 139 ---------------------
...0001-izoordinator-Fixes-to-error-handling.patch | 50 ++++++++
...x-include-dependency-and-remove-redefined.patch | 109 ++++++++++++++++
.../0003-configure.ac-check-for-python2.x.patch | 32 +++++
.../0004-m4-add-py_check_major_version.m4.patch | 44 +++++++
...c-Check-that-the-python-version-is-indeed.patch | 27 ++++
...t-PAN-ID-short-address-and-channel-manual.patch | 126 +++++++++++++++++++
...z-mac-Handle-return-code-from-set-command.patch | 43 +++++++
patches/lowpan-tools-0.3/series | 8 +-
9 files changed, 438 insertions(+), 140 deletions(-)
delete mode 100644 patches/lowpan-tools-0.3/0001-Avoid-crashing-in-izcoordinator.patch
create mode 100644 patches/lowpan-tools-0.3/0001-izoordinator-Fixes-to-error-handling.patch
create mode 100644 patches/lowpan-tools-0.3/0002-addrdb-fix-include-dependency-and-remove-redefined.patch
create mode 100644 patches/lowpan-tools-0.3/0003-configure.ac-check-for-python2.x.patch
create mode 100644 patches/lowpan-tools-0.3/0004-m4-add-py_check_major_version.m4.patch
create mode 100644 patches/lowpan-tools-0.3/0005-configure.ac-Check-that-the-python-version-is-indeed.patch
create mode 100644 patches/lowpan-tools-0.3/0006-Allow-to-set-PAN-ID-short-address-and-channel-manual.patch
create mode 100644 patches/lowpan-tools-0.3/0007-iz-mac-Handle-return-code-from-set-command.patch
diff --git a/patches/lowpan-tools-0.3/0001-Avoid-crashing-in-izcoordinator.patch b/patches/lowpan-tools-0.3/0001-Avoid-crashing-in-izcoordinator.patch
deleted file mode 100644
index 1b44f55..0000000
--- a/patches/lowpan-tools-0.3/0001-Avoid-crashing-in-izcoordinator.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-From: Alexander Aring <alex.aring@gmail.com>
-Date: Thu, 28 Feb 2013 13:17:08 +0100
-Subject: [PATCH] Avoid crashing in izcoordinator.
-
-This patch fixes some logging issues in lowpan-tools to avoid crashing
-of izcoordinator.
-
-Posted on linux-zigbee-devel mailinglist from Tom Carroll:
-http://www.mail-archive.com/linux-zigbee-devel@lists.sourceforge.net/msg01224.html
-
-Signed-off-by: Alexander Aring <alex.aring@gmail.com>
----
- lib/logging.c | 6 +++++-
- src/coordinator.c | 32 +++++++++++++++-----------------
- 2 files changed, 20 insertions(+), 18 deletions(-)
- mode change 100644 => 100755 src/coordinator.c
-
-diff --git a/lib/logging.c b/lib/logging.c
-index 3ec30ee..f37531e 100644
---- a/lib/logging.c
-+++ b/lib/logging.c
-@@ -45,8 +45,12 @@ static void log_string(int level, char *s)
- void init_log(char * name, int level)
- {
- #ifdef HAVE_SYSLOG_H
-+ int option = LOG_PID|LOG_CONS|LOG_NOWAIT;
-+
- log_level = level;
-- openlog(name, LOG_PID|LOG_CONS|LOG_NOWAIT, LOG_DAEMON);
-+ if (log_level > 0)
-+ option |= LOG_PERROR;
-+ openlog(name, option, LOG_DAEMON);
- #endif
- }
-
-diff --git a/src/coordinator.c b/src/coordinator.c
-old mode 100644
-new mode 100755
-index a09633a..3322e3e
---- a/src/coordinator.c
-+++ b/src/coordinator.c
-@@ -64,10 +64,10 @@ extern int yydebug;
-
- static void cleanup(int ret);
-
--static void log_msg_nl_perror(char *s, int err)
-+static void log_msg_nl_perror(const char *s, int res)
- {
-- if (err != NLE_SUCCESS) {
-- log_msg(0, "%s: %s", s, nl_geterror(err));
-+ if (res < 0) {
-+ log_msg(0, "%s: %s", s, nl_geterror(-res));
- cleanup(1);
- }
- }
-@@ -93,8 +93,8 @@ static int mlme_start(uint16_t short_addr, uint16_t pan, uint8_t channel, uint8_
- nla_put_u8(msg, IEEE802154_ATTR_BAT_EXT, 0);
- nla_put_u8(msg, IEEE802154_ATTR_COORD_REALIGN, 0);
- #endif
-- int err = nl_send_auto_complete(nl, msg);
-- log_msg_nl_perror("nl_send_auto_complete", err);
-+ int res = nl_send_auto_complete(nl, msg);
-+ log_msg_nl_perror("nl_send_auto_complete", res);
- return 0;
- }
-
-@@ -127,9 +127,9 @@ static int coordinator_associate(struct genlmsghdr *ghdr, struct nlattr **attrs)
- nla_put_u64(msg, IEEE802154_ATTR_DEST_HW_ADDR, nla_get_u64(attrs[IEEE802154_ATTR_SRC_HW_ADDR]));
- nla_put_u16(msg, IEEE802154_ATTR_DEST_SHORT_ADDR, shaddr);
-
-- int err = nl_send_auto_complete(nl, msg);
-+ int res = nl_send_auto_complete(nl, msg);
-
-- log_msg_nl_perror("nl_send_auto_complete", err);
-+ log_msg_nl_perror("nl_send_auto_complete", res);
-
- return 0;
- }
-@@ -308,7 +308,6 @@ int main(int argc, char **argv)
- #else
- opt = getopt(argc, argv, "l:f:d:m:n:i:s:p:c:hv");
- #endif
-- fprintf(stderr, "Opt: %c (%hhx)\n", opt, opt);
- if (opt == -1)
- break;
-
-@@ -364,7 +363,6 @@ int main(int argc, char **argv)
- usage(pname);
- return -1;
- }
-- lease_file[sizeof(lease_file)-1] = '\0';
- if (debug > 1)
- yydebug = 1; /* Parser debug */
- else
-@@ -396,19 +394,19 @@ int main(int argc, char **argv)
- sa.sa_handler = SIG_IGN;
- sigaction(SIGPIPE, &sa, NULL);
-
-- int err = NLE_SUCCESS;
-+ int res = 0;
- nl = nl_socket_alloc();
-
- if (!nl) {
-- log_msg_nl_perror("nl_sock_alloc", NLE_NOMEM);
-+ log_msg_nl_perror("nl_sock_alloc", -NLE_NOMEM);
- return 1;
- }
-
-- err = genl_connect(nl);
-- log_msg_nl_perror("genl_connect", err);
-+ res = genl_connect(nl);
-+ log_msg_nl_perror("genl_connect", res);
-
- family = genl_ctrl_resolve(nl, IEEE802154_NL_NAME);
-- log_msg_nl_perror("genl_ctrl_resolve", NLE_NOMEM);
-+ log_msg_nl_perror("genl_ctrl_resolve", family);
-
- nl_socket_add_membership(nl, nl_get_multicast_id(nl, IEEE802154_NL_NAME, IEEE802154_MCAST_COORD_NAME));
-
-@@ -449,7 +447,7 @@ int main(int argc, char **argv)
- return 2;
- }
- }
-- pid_fd = open (PID_FILE, O_WRONLY | O_CREAT, 0640);
-+ pid_fd = open (pid_file, O_WRONLY | O_TRUNC | O_CREAT, 0640);
- if (pid_fd < 0) {
- perror ("open");
- return 1;
-@@ -469,8 +467,8 @@ int main(int argc, char **argv)
- mlme_start(short_addr, pan, channel, 1, iface);
-
- while (!die_flag) {
-- err = nl_recvmsgs_default(nl);
-- log_msg_nl_perror("nl_recvmsgs", err);
-+ res = nl_recvmsgs_default(nl);
-+ log_msg_nl_perror("nl_recvmsgs", res);
- }
- cleanup(0);
-
diff --git a/patches/lowpan-tools-0.3/0001-izoordinator-Fixes-to-error-handling.patch b/patches/lowpan-tools-0.3/0001-izoordinator-Fixes-to-error-handling.patch
new file mode 100644
index 0000000..63ad5a9
--- /dev/null
+++ b/patches/lowpan-tools-0.3/0001-izoordinator-Fixes-to-error-handling.patch
@@ -0,0 +1,50 @@
+From 15032ab6d6e3e551e4ad86e61ea84ccbb8b62be0 Mon Sep 17 00:00:00 2001
+From: Alan Ott <alan@signal11.us>
+Date: Thu, 5 Apr 2012 00:22:56 -0400
+Subject: [PATCH 1/7] izoordinator: Fixes to error handling
+
+Some of the error handling was checking for != 0 on functions which
+return positive values on success.
+
+Signed-off-by: Alan Ott <alan@signal11.us>
+---
+ src/coordinator.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/src/coordinator.c b/src/coordinator.c
+index a09633a..c139aae 100644
+--- a/src/coordinator.c
++++ b/src/coordinator.c
+@@ -94,7 +94,8 @@ static int mlme_start(uint16_t short_addr, uint16_t pan, uint8_t channel, uint8_
+ nla_put_u8(msg, IEEE802154_ATTR_COORD_REALIGN, 0);
+ #endif
+ int err = nl_send_auto_complete(nl, msg);
+- log_msg_nl_perror("nl_send_auto_complete", err);
++ if (err < 0)
++ log_msg_nl_perror("nl_send_auto_complete", err);
+ return 0;
+ }
+
+@@ -129,7 +130,8 @@ static int coordinator_associate(struct genlmsghdr *ghdr, struct nlattr **attrs)
+
+ int err = nl_send_auto_complete(nl, msg);
+
+- log_msg_nl_perror("nl_send_auto_complete", err);
++ if (err < 0)
++ log_msg_nl_perror("nl_send_auto_complete", err);
+
+ return 0;
+ }
+@@ -408,7 +410,8 @@ int main(int argc, char **argv)
+ log_msg_nl_perror("genl_connect", err);
+
+ family = genl_ctrl_resolve(nl, IEEE802154_NL_NAME);
+- log_msg_nl_perror("genl_ctrl_resolve", NLE_NOMEM);
++ if (family < 0)
++ log_msg_nl_perror("genl_ctrl_resolve", family);
+
+ nl_socket_add_membership(nl, nl_get_multicast_id(nl, IEEE802154_NL_NAME, IEEE802154_MCAST_COORD_NAME));
+
+--
+1.8.2.3
+
diff --git a/patches/lowpan-tools-0.3/0002-addrdb-fix-include-dependency-and-remove-redefined.patch b/patches/lowpan-tools-0.3/0002-addrdb-fix-include-dependency-and-remove-redefined.patch
new file mode 100644
index 0000000..c299a17
--- /dev/null
+++ b/patches/lowpan-tools-0.3/0002-addrdb-fix-include-dependency-and-remove-redefined.patch
@@ -0,0 +1,109 @@
+From eb4fa43ae3e2b5a3bdf35a7915af70805f891cb9 Mon Sep 17 00:00:00 2001
+From: Alexander Aring <alex.aring@googlemail.com>
+Date: Fri, 21 Dec 2012 06:37:15 +0100
+Subject: [PATCH 2/7] addrdb: fix include dependency and remove redefined
+
+Currently I get this compile error:
+
+coord-config-parse.h:106:14: error: unknown type name 'yyscan_t'
+coord-config-parse.y:38:0: error: "YYDEBUG" redefined [-Werror]
+
+"yyscan_t" is defined in parser.h but parser.h need a include from
+coord-config-parse.h for "YYSTYPE".
+
+This patch removes typedef of "yyscan_t" from parser.h into new
+file scanner.h.
+
+File coord-config-parse.y includes scanner.h at first so "yyscan_t"
+is known.
+
+Remove redefined:
+Move #define YYDEBUG 1 in coord-config-parse.y at first. Otherwise
+it will be defined in generated coord-config-parse.h to 0.
+
+Tested with bison (GNU Bison) 2.7.
+
+Signed-off-by: Alexander Aring <alex.aring@gmail.com>
+---
+ addrdb/coord-config-parse.y | 5 +++--
+ addrdb/parser.h | 5 -----
+ addrdb/scanner.h | 25 +++++++++++++++++++++++++
+ 3 files changed, 28 insertions(+), 7 deletions(-)
+ create mode 100644 addrdb/scanner.h
+
+diff --git a/addrdb/coord-config-parse.y b/addrdb/coord-config-parse.y
+index 6b0328b..2e10a88 100644
+--- a/addrdb/coord-config-parse.y
++++ b/addrdb/coord-config-parse.y
+@@ -20,6 +20,8 @@
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
++ #define YYDEBUG 1
++
+ #include <stdio.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+@@ -32,11 +34,10 @@
+ #include <libcommon.h>
+ #include <time.h>
+ #include <addrdb.h>
++ #include "scanner.h"
+ #include "coord-config-parse.h"
+ #include "parser.h"
+
+- #define YYDEBUG 1
+-
+ static uint16_t short_addr;
+ static uint8_t hwaddr[8];
+ static time_t mystamp;
+diff --git a/addrdb/parser.h b/addrdb/parser.h
+index 0f1b4d8..66e8f41 100644
+--- a/addrdb/parser.h
++++ b/addrdb/parser.h
+@@ -22,11 +22,6 @@
+ #ifndef PARSER_H
+ #define PARSER_H
+
+-#ifndef YY_TYPEDEF_YY_SCANNER_T
+-#define YY_TYPEDEF_YY_SCANNER_T
+-typedef void* yyscan_t;
+-#endif
+-
+ #ifndef YY_EXTRA_TYPE
+ #define YY_EXTRA_TYPE void *
+ #endif
+diff --git a/addrdb/scanner.h b/addrdb/scanner.h
+new file mode 100644
+index 0000000..11fc815
+--- /dev/null
++++ b/addrdb/scanner.h
+@@ -0,0 +1,25 @@
++/*
++ * Linux IEEE 802.15.4 userspace tools
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; version 2 of the License.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License along
++ * with this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++ */
++#ifndef SCANNER_H
++#define SCANNER_H
++
++#ifndef YY_TYPEDEF_YY_SCANNER_T
++#define YY_TYPEDEF_YY_SCANNER_T
++typedef void* yyscan_t;
++#endif
++
++#endif
+--
+1.8.2.3
+
diff --git a/patches/lowpan-tools-0.3/0003-configure.ac-check-for-python2.x.patch b/patches/lowpan-tools-0.3/0003-configure.ac-check-for-python2.x.patch
new file mode 100644
index 0000000..b5885b8
--- /dev/null
+++ b/patches/lowpan-tools-0.3/0003-configure.ac-check-for-python2.x.patch
@@ -0,0 +1,32 @@
+From ee734ebbd220460e73cc871d1f0c652bb9a85439 Mon Sep 17 00:00:00 2001
+From: Alexander Aring <alex.aring@googlemail.com>
+Date: Fri, 21 Dec 2012 06:37:14 +0100
+Subject: [PATCH 3/7] configure.ac: check for python2.x
+
+Check for python2.x at first.
+
+test_DQ.py works with python2.x only.
+'make install' needs python2.x to generate *.pyc files.
+
+Signed-off-by: Alexander Aring <alex.aring@gmail.com>
+---
+ configure.ac | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index c483b4f..6c9f54b 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -77,6 +77,9 @@ AC_PROG_LIBTOOL
+ AM_PROG_LEX
+ AC_PROG_YACC
+ AC_SUBST(LIBTOOL_DEPS)
++# Currently the scripts works with python2.x only
++# Check for this at first
++AC_PATH_PROG(PYTHON, python2 python2.7 python2.6 python2.5 python)
+ AM_PATH_PYTHON(,, [:])
+ AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
+
+--
+1.8.2.3
+
diff --git a/patches/lowpan-tools-0.3/0004-m4-add-py_check_major_version.m4.patch b/patches/lowpan-tools-0.3/0004-m4-add-py_check_major_version.m4.patch
new file mode 100644
index 0000000..3ed7f15
--- /dev/null
+++ b/patches/lowpan-tools-0.3/0004-m4-add-py_check_major_version.m4.patch
@@ -0,0 +1,44 @@
+From 242c594bce69295299d67d5a2c7d4a286fb85fcd Mon Sep 17 00:00:00 2001
+From: Alan Ott <alan@signal11.us>
+Date: Sun, 17 Mar 2013 18:13:45 -0400
+Subject: [PATCH 4/7] m4: add py_check_major_version.m4
+
+Macro to check the Python major version.
+
+This is from stackoverflow user bigleux on page:
+ http://stackoverflow.com/questions/4619664/autofoo-test-for-maximum-version-of-python
+
+Signed-off-by: Alan Ott <alan@signal11.us>
+---
+ m4/py_check_major_version.m4 | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+ create mode 100644 m4/py_check_major_version.m4
+
+diff --git a/m4/py_check_major_version.m4 b/m4/py_check_major_version.m4
+new file mode 100644
+index 0000000..6d45be8
+--- /dev/null
++++ b/m4/py_check_major_version.m4
+@@ -0,0 +1,19 @@
++`# From http://stackoverflow.com/questions/4619664/autofoo-test-for-maximum-version-of-python
++`# stackoverflow user biegleux
++
++`# py_CHECK_MAJOR_VERSION(VARIABLE, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])`
++`# ---------------------------------------------------------------------------`
++`# Run ACTION-IF-TRUE if the VAR has a major version >= VERSION.`
++`# Run ACTION-IF-FALSE otherwise.`
++AC_DEFUN([py_CHECK_MAJOR_VERSION],
++[AC_MSG_CHECKING([whether $1 $$1 major version == $2])
++case $$1 in
++$2*)
++ AC_MSG_RESULT([yes])
++ ifelse([$3], [$3], [:])
++ ;;
++*)
++ AC_MSG_RESULT([no])
++ ifelse([$4], , [AC_MSG_ERROR([$$1 differs from $2])], [$4])
++ ;;
++esac])
+--
+1.8.2.3
+
diff --git a/patches/lowpan-tools-0.3/0005-configure.ac-Check-that-the-python-version-is-indeed.patch b/patches/lowpan-tools-0.3/0005-configure.ac-Check-that-the-python-version-is-indeed.patch
new file mode 100644
index 0000000..6798c0f
--- /dev/null
+++ b/patches/lowpan-tools-0.3/0005-configure.ac-Check-that-the-python-version-is-indeed.patch
@@ -0,0 +1,27 @@
+From 770842e5df5f11718223c52d8fe5257ce29ab629 Mon Sep 17 00:00:00 2001
+From: Alan Ott <alan@signal11.us>
+Date: Sun, 17 Mar 2013 18:18:46 -0400
+Subject: [PATCH 5/7] configure.ac: Check that the python version is indeed 2
+
+Python 3 breaks all our scripts.
+
+Signed-off-by: Alan Ott <alan@signal11.us>
+---
+ configure.ac | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/configure.ac b/configure.ac
+index 6c9f54b..89c2651 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -81,6 +81,7 @@ AC_SUBST(LIBTOOL_DEPS)
+ # Check for this at first
+ AC_PATH_PROG(PYTHON, python2 python2.7 python2.6 python2.5 python)
+ AM_PATH_PYTHON(,, [:])
++py_CHECK_MAJOR_VERSION([PYTHON_VERSION], [2])
+ AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
+
+ # Checks for libraries.
+--
+1.8.2.3
+
diff --git a/patches/lowpan-tools-0.3/0006-Allow-to-set-PAN-ID-short-address-and-channel-manual.patch b/patches/lowpan-tools-0.3/0006-Allow-to-set-PAN-ID-short-address-and-channel-manual.patch
new file mode 100644
index 0000000..88e64fc
--- /dev/null
+++ b/patches/lowpan-tools-0.3/0006-Allow-to-set-PAN-ID-short-address-and-channel-manual.patch
@@ -0,0 +1,126 @@
+From 2f855efcf9e261bbbe6ce1155f2fbc0977f0f9b3 Mon Sep 17 00:00:00 2001
+From: Stefan Schmidt <stefan@datenfreihafen.org>
+Date: Wed, 13 Mar 2013 08:25:02 +0100
+Subject: [PATCH 6/7] Allow to set PAN ID, short address and channel manually.
+
+This allows setting up a network without a PAN
+coordinator. Necessary if you want to be compatible
+with the contiki implementation.
+
+Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
+---
+ src/iz-mac.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 91 insertions(+)
+
+diff --git a/src/iz-mac.c b/src/iz-mac.c
+index 7c1e616..be980d6 100644
+--- a/src/iz-mac.c
++++ b/src/iz-mac.c
+@@ -253,6 +253,88 @@ static struct iz_cmd_event list_response_event[] = {
+ {},
+ };
+
++/******************/
++/* SET handling */
++/******************/
++
++static iz_res_t set_parse(struct iz_cmd *cmd)
++{
++ cmd->flags = NLM_F_REQUEST;
++ return IZ_CONT_OK;
++}
++
++static iz_res_t set_request(struct iz_cmd *cmd, struct nl_msg *msg)
++{
++ char *dummy;
++ uint16_t pan_id, short_addr;
++ uint8_t chan;
++
++ if (!cmd->argv[1])
++ return IZ_STOP_ERR;
++ NLA_PUT_STRING(msg, IEEE802154_ATTR_DEV_NAME, cmd->argv[1]);
++
++ if (!cmd->argv[2])
++ return IZ_STOP_ERR;
++ pan_id = strtol(cmd->argv[2], &dummy, 16);
++ if (*dummy) {
++ printf("Bad PAN ID!\n");
++ return IZ_STOP_ERR;
++ }
++ NLA_PUT_U16(msg, IEEE802154_ATTR_COORD_PAN_ID, pan_id);
++
++ if (!cmd->argv[3])
++ return IZ_STOP_ERR;
++ short_addr = strtol(cmd->argv[3], &dummy, 16);
++ if (*dummy) {
++ printf("Bad short address!\n");
++ return IZ_STOP_ERR;
++ }
++ NLA_PUT_U16(msg, IEEE802154_ATTR_COORD_SHORT_ADDR, short_addr);
++
++ if (!cmd->argv[4])
++ return IZ_STOP_ERR;
++ chan = strtol(cmd->argv[4], &dummy, 10);
++ if (*dummy) {
++ printf("Bad channel number!\n");
++ return IZ_STOP_ERR;
++ }
++ NLA_PUT_U8(msg, IEEE802154_ATTR_CHANNEL, chan);
++
++ /* set all unneeded attributes to 0*/
++ NLA_PUT_U8(msg, IEEE802154_ATTR_PAN_COORD, 0);
++ NLA_PUT_U8(msg, IEEE802154_ATTR_BCN_ORD, 0);
++ NLA_PUT_U8(msg, IEEE802154_ATTR_SF_ORD, 0);
++ NLA_PUT_U8(msg, IEEE802154_ATTR_BAT_EXT, 0);
++ NLA_PUT_U8(msg, IEEE802154_ATTR_COORD_REALIGN, 0);
++
++ return IZ_CONT_OK;
++
++nla_put_failure:
++ return IZ_STOP_ERR;
++}
++
++static iz_res_t set_response(struct iz_cmd *cmd, struct genlmsghdr *ghdr, struct nlattr **attrs)
++{
++ if (!attrs[IEEE802154_ATTR_SHORT_ADDR] ||
++ !attrs[IEEE802154_ATTR_STATUS] )
++ return IZ_STOP_ERR;
++
++ printf("Set PAN ID %04hx, short address %04hx, status %i\n",
++ nla_get_u16(attrs[IEEE802154_ATTR_COORD_PAN_ID]),
++ nla_get_u16(attrs[IEEE802154_ATTR_SHORT_ADDR]),
++ nla_get_u8(attrs[IEEE802154_ATTR_CHANNEL]));
++
++ return IZ_STOP_OK;
++}
++
++static struct iz_cmd_event set_response_event[] = {
++ {
++ .call = set_response,
++ .nl = IEEE802154_START_CONF,
++ },
++ {},
++};
++
+ /************************/
+ /* ASSOCIATE handling */
+ /************************/
+@@ -473,6 +555,15 @@ const struct iz_module iz_mac = {
+ .response = list_response_event,
+ .finish = list_finish,
+ },
++ {
++ .name = "set",
++ .usage = "<iface> <pan> <addr> <channel>",
++ .doc = "Set address, channel and pan for an interface.",
++ .nl_cmd = IEEE802154_START_REQ,
++ .parse = set_parse,
++ .request = set_request,
++ .response = set_response_event,
++ },
+ {}}
+ };
+
+--
+1.8.2.3
+
diff --git a/patches/lowpan-tools-0.3/0007-iz-mac-Handle-return-code-from-set-command.patch b/patches/lowpan-tools-0.3/0007-iz-mac-Handle-return-code-from-set-command.patch
new file mode 100644
index 0000000..d4f48ca
--- /dev/null
+++ b/patches/lowpan-tools-0.3/0007-iz-mac-Handle-return-code-from-set-command.patch
@@ -0,0 +1,43 @@
+From a1d9615adde6d1a568813c24a128273ed755af04 Mon Sep 17 00:00:00 2001
+From: Alan Ott <alan@signal11.us>
+Date: Sun, 17 Mar 2013 21:22:52 -0400
+Subject: [PATCH 7/7] iz-mac: Handle return code from "set" command
+
+The iz set command will fail if the PAN ID is invalid. Handle this failure.
+
+Signed-off-by: Alan Ott <alan@signal11.us>
+---
+ src/iz-mac.c | 16 +++++++++-------
+ 1 file changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/src/iz-mac.c b/src/iz-mac.c
+index be980d6..838229c 100644
+--- a/src/iz-mac.c
++++ b/src/iz-mac.c
+@@ -315,14 +315,16 @@ nla_put_failure:
+
+ static iz_res_t set_response(struct iz_cmd *cmd, struct genlmsghdr *ghdr, struct nlattr **attrs)
+ {
+- if (!attrs[IEEE802154_ATTR_SHORT_ADDR] ||
+- !attrs[IEEE802154_ATTR_STATUS] )
++ uint8_t status;
++
++ if (!attrs[IEEE802154_ATTR_STATUS])
+ return IZ_STOP_ERR;
+-
+- printf("Set PAN ID %04hx, short address %04hx, status %i\n",
+- nla_get_u16(attrs[IEEE802154_ATTR_COORD_PAN_ID]),
+- nla_get_u16(attrs[IEEE802154_ATTR_SHORT_ADDR]),
+- nla_get_u8(attrs[IEEE802154_ATTR_CHANNEL]));
++
++ status = nla_get_u8(attrs[IEEE802154_ATTR_STATUS]);
++ if (status != 0) {
++ printf("Operation Failed. Check channel and PAN ID\n");
++ return IZ_STOP_ERR;
++ }
+
+ return IZ_STOP_OK;
+ }
+--
+1.8.2.3
+
diff --git a/patches/lowpan-tools-0.3/series b/patches/lowpan-tools-0.3/series
index 7f7c24f..1652508 100644
--- a/patches/lowpan-tools-0.3/series
+++ b/patches/lowpan-tools-0.3/series
@@ -1 +1,7 @@
-0001-Avoid-crashing-in-izcoordinator.patch
+0001-izoordinator-Fixes-to-error-handling.patch
+0002-addrdb-fix-include-dependency-and-remove-redefined.patch
+0003-configure.ac-check-for-python2.x.patch
+0004-m4-add-py_check_major_version.m4.patch
+0005-configure.ac-Check-that-the-python-version-is-indeed.patch
+0006-Allow-to-set-PAN-ID-short-address-and-channel-manual.patch
+0007-iz-mac-Handle-return-code-from-set-command.patch
--
1.8.2.3
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ptxdist] [PATCH] lowpan-tools: update lowpan-patches
2013-05-12 19:29 [ptxdist] [PATCH] lowpan-tools: update lowpan-patches Alexander Aring
@ 2013-05-13 7:42 ` Michael Olbrich
2013-05-13 8:46 ` Alexander Aring
0 siblings, 1 reply; 5+ messages in thread
From: Michael Olbrich @ 2013-05-13 7:42 UTC (permalink / raw)
To: ptxdist
On Sun, May 12, 2013 at 09:29:39PM +0200, Alexander Aring wrote:
> Currently there is no way to make a new lowpan-tools release.
> This patch synchronize the patches from version 0.3 with current
> git master.
>
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
> .../0001-Avoid-crashing-in-izcoordinator.patch | 139 ---------------------
Is this patch no longer relevant?
> ...0001-izoordinator-Fixes-to-error-handling.patch | 50 ++++++++
> ...x-include-dependency-and-remove-redefined.patch | 109 ++++++++++++++++
> .../0003-configure.ac-check-for-python2.x.patch | 32 +++++
This patch modifies configure.ac. You need to add a link to ../autogen.sh
so that ptxdist knows to recreate configure.
Michael
> .../0004-m4-add-py_check_major_version.m4.patch | 44 +++++++
> ...c-Check-that-the-python-version-is-indeed.patch | 27 ++++
> ...t-PAN-ID-short-address-and-channel-manual.patch | 126 +++++++++++++++++++
> ...z-mac-Handle-return-code-from-set-command.patch | 43 +++++++
> patches/lowpan-tools-0.3/series | 8 +-
> 9 files changed, 438 insertions(+), 140 deletions(-)
> delete mode 100644 patches/lowpan-tools-0.3/0001-Avoid-crashing-in-izcoordinator.patch
> create mode 100644 patches/lowpan-tools-0.3/0001-izoordinator-Fixes-to-error-handling.patch
> create mode 100644 patches/lowpan-tools-0.3/0002-addrdb-fix-include-dependency-and-remove-redefined.patch
> create mode 100644 patches/lowpan-tools-0.3/0003-configure.ac-check-for-python2.x.patch
> create mode 100644 patches/lowpan-tools-0.3/0004-m4-add-py_check_major_version.m4.patch
> create mode 100644 patches/lowpan-tools-0.3/0005-configure.ac-Check-that-the-python-version-is-indeed.patch
> create mode 100644 patches/lowpan-tools-0.3/0006-Allow-to-set-PAN-ID-short-address-and-channel-manual.patch
> create mode 100644 patches/lowpan-tools-0.3/0007-iz-mac-Handle-return-code-from-set-command.patch
>
> diff --git a/patches/lowpan-tools-0.3/0001-Avoid-crashing-in-izcoordinator.patch b/patches/lowpan-tools-0.3/0001-Avoid-crashing-in-izcoordinator.patch
> deleted file mode 100644
> index 1b44f55..0000000
> --- a/patches/lowpan-tools-0.3/0001-Avoid-crashing-in-izcoordinator.patch
> +++ /dev/null
> @@ -1,139 +0,0 @@
> -From: Alexander Aring <alex.aring@gmail.com>
> -Date: Thu, 28 Feb 2013 13:17:08 +0100
> -Subject: [PATCH] Avoid crashing in izcoordinator.
> -
> -This patch fixes some logging issues in lowpan-tools to avoid crashing
> -of izcoordinator.
> -
> -Posted on linux-zigbee-devel mailinglist from Tom Carroll:
> -http://www.mail-archive.com/linux-zigbee-devel@lists.sourceforge.net/msg01224.html
> -
> -Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ----
> - lib/logging.c | 6 +++++-
> - src/coordinator.c | 32 +++++++++++++++-----------------
> - 2 files changed, 20 insertions(+), 18 deletions(-)
> - mode change 100644 => 100755 src/coordinator.c
> -
> -diff --git a/lib/logging.c b/lib/logging.c
> -index 3ec30ee..f37531e 100644
> ---- a/lib/logging.c
> -+++ b/lib/logging.c
> -@@ -45,8 +45,12 @@ static void log_string(int level, char *s)
> - void init_log(char * name, int level)
> - {
> - #ifdef HAVE_SYSLOG_H
> -+ int option = LOG_PID|LOG_CONS|LOG_NOWAIT;
> -+
> - log_level = level;
> -- openlog(name, LOG_PID|LOG_CONS|LOG_NOWAIT, LOG_DAEMON);
> -+ if (log_level > 0)
> -+ option |= LOG_PERROR;
> -+ openlog(name, option, LOG_DAEMON);
> - #endif
> - }
> -
> -diff --git a/src/coordinator.c b/src/coordinator.c
> -old mode 100644
> -new mode 100755
> -index a09633a..3322e3e
> ---- a/src/coordinator.c
> -+++ b/src/coordinator.c
> -@@ -64,10 +64,10 @@ extern int yydebug;
> -
> - static void cleanup(int ret);
> -
> --static void log_msg_nl_perror(char *s, int err)
> -+static void log_msg_nl_perror(const char *s, int res)
> - {
> -- if (err != NLE_SUCCESS) {
> -- log_msg(0, "%s: %s", s, nl_geterror(err));
> -+ if (res < 0) {
> -+ log_msg(0, "%s: %s", s, nl_geterror(-res));
> - cleanup(1);
> - }
> - }
> -@@ -93,8 +93,8 @@ static int mlme_start(uint16_t short_addr, uint16_t pan, uint8_t channel, uint8_
> - nla_put_u8(msg, IEEE802154_ATTR_BAT_EXT, 0);
> - nla_put_u8(msg, IEEE802154_ATTR_COORD_REALIGN, 0);
> - #endif
> -- int err = nl_send_auto_complete(nl, msg);
> -- log_msg_nl_perror("nl_send_auto_complete", err);
> -+ int res = nl_send_auto_complete(nl, msg);
> -+ log_msg_nl_perror("nl_send_auto_complete", res);
> - return 0;
> - }
> -
> -@@ -127,9 +127,9 @@ static int coordinator_associate(struct genlmsghdr *ghdr, struct nlattr **attrs)
> - nla_put_u64(msg, IEEE802154_ATTR_DEST_HW_ADDR, nla_get_u64(attrs[IEEE802154_ATTR_SRC_HW_ADDR]));
> - nla_put_u16(msg, IEEE802154_ATTR_DEST_SHORT_ADDR, shaddr);
> -
> -- int err = nl_send_auto_complete(nl, msg);
> -+ int res = nl_send_auto_complete(nl, msg);
> -
> -- log_msg_nl_perror("nl_send_auto_complete", err);
> -+ log_msg_nl_perror("nl_send_auto_complete", res);
> -
> - return 0;
> - }
> -@@ -308,7 +308,6 @@ int main(int argc, char **argv)
> - #else
> - opt = getopt(argc, argv, "l:f:d:m:n:i:s:p:c:hv");
> - #endif
> -- fprintf(stderr, "Opt: %c (%hhx)\n", opt, opt);
> - if (opt == -1)
> - break;
> -
> -@@ -364,7 +363,6 @@ int main(int argc, char **argv)
> - usage(pname);
> - return -1;
> - }
> -- lease_file[sizeof(lease_file)-1] = '\0';
> - if (debug > 1)
> - yydebug = 1; /* Parser debug */
> - else
> -@@ -396,19 +394,19 @@ int main(int argc, char **argv)
> - sa.sa_handler = SIG_IGN;
> - sigaction(SIGPIPE, &sa, NULL);
> -
> -- int err = NLE_SUCCESS;
> -+ int res = 0;
> - nl = nl_socket_alloc();
> -
> - if (!nl) {
> -- log_msg_nl_perror("nl_sock_alloc", NLE_NOMEM);
> -+ log_msg_nl_perror("nl_sock_alloc", -NLE_NOMEM);
> - return 1;
> - }
> -
> -- err = genl_connect(nl);
> -- log_msg_nl_perror("genl_connect", err);
> -+ res = genl_connect(nl);
> -+ log_msg_nl_perror("genl_connect", res);
> -
> - family = genl_ctrl_resolve(nl, IEEE802154_NL_NAME);
> -- log_msg_nl_perror("genl_ctrl_resolve", NLE_NOMEM);
> -+ log_msg_nl_perror("genl_ctrl_resolve", family);
> -
> - nl_socket_add_membership(nl, nl_get_multicast_id(nl, IEEE802154_NL_NAME, IEEE802154_MCAST_COORD_NAME));
> -
> -@@ -449,7 +447,7 @@ int main(int argc, char **argv)
> - return 2;
> - }
> - }
> -- pid_fd = open (PID_FILE, O_WRONLY | O_CREAT, 0640);
> -+ pid_fd = open (pid_file, O_WRONLY | O_TRUNC | O_CREAT, 0640);
> - if (pid_fd < 0) {
> - perror ("open");
> - return 1;
> -@@ -469,8 +467,8 @@ int main(int argc, char **argv)
> - mlme_start(short_addr, pan, channel, 1, iface);
> -
> - while (!die_flag) {
> -- err = nl_recvmsgs_default(nl);
> -- log_msg_nl_perror("nl_recvmsgs", err);
> -+ res = nl_recvmsgs_default(nl);
> -+ log_msg_nl_perror("nl_recvmsgs", res);
> - }
> - cleanup(0);
> -
> diff --git a/patches/lowpan-tools-0.3/0001-izoordinator-Fixes-to-error-handling.patch b/patches/lowpan-tools-0.3/0001-izoordinator-Fixes-to-error-handling.patch
> new file mode 100644
> index 0000000..63ad5a9
> --- /dev/null
> +++ b/patches/lowpan-tools-0.3/0001-izoordinator-Fixes-to-error-handling.patch
> @@ -0,0 +1,50 @@
> +From 15032ab6d6e3e551e4ad86e61ea84ccbb8b62be0 Mon Sep 17 00:00:00 2001
> +From: Alan Ott <alan@signal11.us>
> +Date: Thu, 5 Apr 2012 00:22:56 -0400
> +Subject: [PATCH 1/7] izoordinator: Fixes to error handling
> +
> +Some of the error handling was checking for != 0 on functions which
> +return positive values on success.
> +
> +Signed-off-by: Alan Ott <alan@signal11.us>
> +---
> + src/coordinator.c | 9 ++++++---
> + 1 file changed, 6 insertions(+), 3 deletions(-)
> +
> +diff --git a/src/coordinator.c b/src/coordinator.c
> +index a09633a..c139aae 100644
> +--- a/src/coordinator.c
> ++++ b/src/coordinator.c
> +@@ -94,7 +94,8 @@ static int mlme_start(uint16_t short_addr, uint16_t pan, uint8_t channel, uint8_
> + nla_put_u8(msg, IEEE802154_ATTR_COORD_REALIGN, 0);
> + #endif
> + int err = nl_send_auto_complete(nl, msg);
> +- log_msg_nl_perror("nl_send_auto_complete", err);
> ++ if (err < 0)
> ++ log_msg_nl_perror("nl_send_auto_complete", err);
> + return 0;
> + }
> +
> +@@ -129,7 +130,8 @@ static int coordinator_associate(struct genlmsghdr *ghdr, struct nlattr **attrs)
> +
> + int err = nl_send_auto_complete(nl, msg);
> +
> +- log_msg_nl_perror("nl_send_auto_complete", err);
> ++ if (err < 0)
> ++ log_msg_nl_perror("nl_send_auto_complete", err);
> +
> + return 0;
> + }
> +@@ -408,7 +410,8 @@ int main(int argc, char **argv)
> + log_msg_nl_perror("genl_connect", err);
> +
> + family = genl_ctrl_resolve(nl, IEEE802154_NL_NAME);
> +- log_msg_nl_perror("genl_ctrl_resolve", NLE_NOMEM);
> ++ if (family < 0)
> ++ log_msg_nl_perror("genl_ctrl_resolve", family);
> +
> + nl_socket_add_membership(nl, nl_get_multicast_id(nl, IEEE802154_NL_NAME, IEEE802154_MCAST_COORD_NAME));
> +
> +--
> +1.8.2.3
> +
> diff --git a/patches/lowpan-tools-0.3/0002-addrdb-fix-include-dependency-and-remove-redefined.patch b/patches/lowpan-tools-0.3/0002-addrdb-fix-include-dependency-and-remove-redefined.patch
> new file mode 100644
> index 0000000..c299a17
> --- /dev/null
> +++ b/patches/lowpan-tools-0.3/0002-addrdb-fix-include-dependency-and-remove-redefined.patch
> @@ -0,0 +1,109 @@
> +From eb4fa43ae3e2b5a3bdf35a7915af70805f891cb9 Mon Sep 17 00:00:00 2001
> +From: Alexander Aring <alex.aring@googlemail.com>
> +Date: Fri, 21 Dec 2012 06:37:15 +0100
> +Subject: [PATCH 2/7] addrdb: fix include dependency and remove redefined
> +
> +Currently I get this compile error:
> +
> +coord-config-parse.h:106:14: error: unknown type name 'yyscan_t'
> +coord-config-parse.y:38:0: error: "YYDEBUG" redefined [-Werror]
> +
> +"yyscan_t" is defined in parser.h but parser.h need a include from
> +coord-config-parse.h for "YYSTYPE".
> +
> +This patch removes typedef of "yyscan_t" from parser.h into new
> +file scanner.h.
> +
> +File coord-config-parse.y includes scanner.h at first so "yyscan_t"
> +is known.
> +
> +Remove redefined:
> +Move #define YYDEBUG 1 in coord-config-parse.y at first. Otherwise
> +it will be defined in generated coord-config-parse.h to 0.
> +
> +Tested with bison (GNU Bison) 2.7.
> +
> +Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> +---
> + addrdb/coord-config-parse.y | 5 +++--
> + addrdb/parser.h | 5 -----
> + addrdb/scanner.h | 25 +++++++++++++++++++++++++
> + 3 files changed, 28 insertions(+), 7 deletions(-)
> + create mode 100644 addrdb/scanner.h
> +
> +diff --git a/addrdb/coord-config-parse.y b/addrdb/coord-config-parse.y
> +index 6b0328b..2e10a88 100644
> +--- a/addrdb/coord-config-parse.y
> ++++ b/addrdb/coord-config-parse.y
> +@@ -20,6 +20,8 @@
> + * with this program; if not, write to the Free Software Foundation, Inc.,
> + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> + */
> ++ #define YYDEBUG 1
> ++
> + #include <stdio.h>
> + #include <unistd.h>
> + #include <stdlib.h>
> +@@ -32,11 +34,10 @@
> + #include <libcommon.h>
> + #include <time.h>
> + #include <addrdb.h>
> ++ #include "scanner.h"
> + #include "coord-config-parse.h"
> + #include "parser.h"
> +
> +- #define YYDEBUG 1
> +-
> + static uint16_t short_addr;
> + static uint8_t hwaddr[8];
> + static time_t mystamp;
> +diff --git a/addrdb/parser.h b/addrdb/parser.h
> +index 0f1b4d8..66e8f41 100644
> +--- a/addrdb/parser.h
> ++++ b/addrdb/parser.h
> +@@ -22,11 +22,6 @@
> + #ifndef PARSER_H
> + #define PARSER_H
> +
> +-#ifndef YY_TYPEDEF_YY_SCANNER_T
> +-#define YY_TYPEDEF_YY_SCANNER_T
> +-typedef void* yyscan_t;
> +-#endif
> +-
> + #ifndef YY_EXTRA_TYPE
> + #define YY_EXTRA_TYPE void *
> + #endif
> +diff --git a/addrdb/scanner.h b/addrdb/scanner.h
> +new file mode 100644
> +index 0000000..11fc815
> +--- /dev/null
> ++++ b/addrdb/scanner.h
> +@@ -0,0 +1,25 @@
> ++/*
> ++ * Linux IEEE 802.15.4 userspace tools
> ++ *
> ++ * This program is free software; you can redistribute it and/or modify
> ++ * it under the terms of the GNU General Public License as published by
> ++ * the Free Software Foundation; version 2 of the License.
> ++ *
> ++ * This program is distributed in the hope that it will be useful,
> ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
> ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> ++ * GNU General Public License for more details.
> ++ *
> ++ * You should have received a copy of the GNU General Public License along
> ++ * with this program; if not, write to the Free Software Foundation, Inc.,
> ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> ++ */
> ++#ifndef SCANNER_H
> ++#define SCANNER_H
> ++
> ++#ifndef YY_TYPEDEF_YY_SCANNER_T
> ++#define YY_TYPEDEF_YY_SCANNER_T
> ++typedef void* yyscan_t;
> ++#endif
> ++
> ++#endif
> +--
> +1.8.2.3
> +
> diff --git a/patches/lowpan-tools-0.3/0003-configure.ac-check-for-python2.x.patch b/patches/lowpan-tools-0.3/0003-configure.ac-check-for-python2.x.patch
> new file mode 100644
> index 0000000..b5885b8
> --- /dev/null
> +++ b/patches/lowpan-tools-0.3/0003-configure.ac-check-for-python2.x.patch
> @@ -0,0 +1,32 @@
> +From ee734ebbd220460e73cc871d1f0c652bb9a85439 Mon Sep 17 00:00:00 2001
> +From: Alexander Aring <alex.aring@googlemail.com>
> +Date: Fri, 21 Dec 2012 06:37:14 +0100
> +Subject: [PATCH 3/7] configure.ac: check for python2.x
> +
> +Check for python2.x at first.
> +
> +test_DQ.py works with python2.x only.
> +'make install' needs python2.x to generate *.pyc files.
> +
> +Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> +---
> + configure.ac | 3 +++
> + 1 file changed, 3 insertions(+)
> +
> +diff --git a/configure.ac b/configure.ac
> +index c483b4f..6c9f54b 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -77,6 +77,9 @@ AC_PROG_LIBTOOL
> + AM_PROG_LEX
> + AC_PROG_YACC
> + AC_SUBST(LIBTOOL_DEPS)
> ++# Currently the scripts works with python2.x only
> ++# Check for this at first
> ++AC_PATH_PROG(PYTHON, python2 python2.7 python2.6 python2.5 python)
> + AM_PATH_PYTHON(,, [:])
> + AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
> +
> +--
> +1.8.2.3
> +
> diff --git a/patches/lowpan-tools-0.3/0004-m4-add-py_check_major_version.m4.patch b/patches/lowpan-tools-0.3/0004-m4-add-py_check_major_version.m4.patch
> new file mode 100644
> index 0000000..3ed7f15
> --- /dev/null
> +++ b/patches/lowpan-tools-0.3/0004-m4-add-py_check_major_version.m4.patch
> @@ -0,0 +1,44 @@
> +From 242c594bce69295299d67d5a2c7d4a286fb85fcd Mon Sep 17 00:00:00 2001
> +From: Alan Ott <alan@signal11.us>
> +Date: Sun, 17 Mar 2013 18:13:45 -0400
> +Subject: [PATCH 4/7] m4: add py_check_major_version.m4
> +
> +Macro to check the Python major version.
> +
> +This is from stackoverflow user bigleux on page:
> + http://stackoverflow.com/questions/4619664/autofoo-test-for-maximum-version-of-python
> +
> +Signed-off-by: Alan Ott <alan@signal11.us>
> +---
> + m4/py_check_major_version.m4 | 19 +++++++++++++++++++
> + 1 file changed, 19 insertions(+)
> + create mode 100644 m4/py_check_major_version.m4
> +
> +diff --git a/m4/py_check_major_version.m4 b/m4/py_check_major_version.m4
> +new file mode 100644
> +index 0000000..6d45be8
> +--- /dev/null
> ++++ b/m4/py_check_major_version.m4
> +@@ -0,0 +1,19 @@
> ++`# From http://stackoverflow.com/questions/4619664/autofoo-test-for-maximum-version-of-python
> ++`# stackoverflow user biegleux
> ++
> ++`# py_CHECK_MAJOR_VERSION(VARIABLE, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])`
> ++`# ---------------------------------------------------------------------------`
> ++`# Run ACTION-IF-TRUE if the VAR has a major version >= VERSION.`
> ++`# Run ACTION-IF-FALSE otherwise.`
> ++AC_DEFUN([py_CHECK_MAJOR_VERSION],
> ++[AC_MSG_CHECKING([whether $1 $$1 major version == $2])
> ++case $$1 in
> ++$2*)
> ++ AC_MSG_RESULT([yes])
> ++ ifelse([$3], [$3], [:])
> ++ ;;
> ++*)
> ++ AC_MSG_RESULT([no])
> ++ ifelse([$4], , [AC_MSG_ERROR([$$1 differs from $2])], [$4])
> ++ ;;
> ++esac])
> +--
> +1.8.2.3
> +
> diff --git a/patches/lowpan-tools-0.3/0005-configure.ac-Check-that-the-python-version-is-indeed.patch b/patches/lowpan-tools-0.3/0005-configure.ac-Check-that-the-python-version-is-indeed.patch
> new file mode 100644
> index 0000000..6798c0f
> --- /dev/null
> +++ b/patches/lowpan-tools-0.3/0005-configure.ac-Check-that-the-python-version-is-indeed.patch
> @@ -0,0 +1,27 @@
> +From 770842e5df5f11718223c52d8fe5257ce29ab629 Mon Sep 17 00:00:00 2001
> +From: Alan Ott <alan@signal11.us>
> +Date: Sun, 17 Mar 2013 18:18:46 -0400
> +Subject: [PATCH 5/7] configure.ac: Check that the python version is indeed 2
> +
> +Python 3 breaks all our scripts.
> +
> +Signed-off-by: Alan Ott <alan@signal11.us>
> +---
> + configure.ac | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/configure.ac b/configure.ac
> +index 6c9f54b..89c2651 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -81,6 +81,7 @@ AC_SUBST(LIBTOOL_DEPS)
> + # Check for this at first
> + AC_PATH_PROG(PYTHON, python2 python2.7 python2.6 python2.5 python)
> + AM_PATH_PYTHON(,, [:])
> ++py_CHECK_MAJOR_VERSION([PYTHON_VERSION], [2])
> + AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
> +
> + # Checks for libraries.
> +--
> +1.8.2.3
> +
> diff --git a/patches/lowpan-tools-0.3/0006-Allow-to-set-PAN-ID-short-address-and-channel-manual.patch b/patches/lowpan-tools-0.3/0006-Allow-to-set-PAN-ID-short-address-and-channel-manual.patch
> new file mode 100644
> index 0000000..88e64fc
> --- /dev/null
> +++ b/patches/lowpan-tools-0.3/0006-Allow-to-set-PAN-ID-short-address-and-channel-manual.patch
> @@ -0,0 +1,126 @@
> +From 2f855efcf9e261bbbe6ce1155f2fbc0977f0f9b3 Mon Sep 17 00:00:00 2001
> +From: Stefan Schmidt <stefan@datenfreihafen.org>
> +Date: Wed, 13 Mar 2013 08:25:02 +0100
> +Subject: [PATCH 6/7] Allow to set PAN ID, short address and channel manually.
> +
> +This allows setting up a network without a PAN
> +coordinator. Necessary if you want to be compatible
> +with the contiki implementation.
> +
> +Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
> +---
> + src/iz-mac.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> + 1 file changed, 91 insertions(+)
> +
> +diff --git a/src/iz-mac.c b/src/iz-mac.c
> +index 7c1e616..be980d6 100644
> +--- a/src/iz-mac.c
> ++++ b/src/iz-mac.c
> +@@ -253,6 +253,88 @@ static struct iz_cmd_event list_response_event[] = {
> + {},
> + };
> +
> ++/******************/
> ++/* SET handling */
> ++/******************/
> ++
> ++static iz_res_t set_parse(struct iz_cmd *cmd)
> ++{
> ++ cmd->flags = NLM_F_REQUEST;
> ++ return IZ_CONT_OK;
> ++}
> ++
> ++static iz_res_t set_request(struct iz_cmd *cmd, struct nl_msg *msg)
> ++{
> ++ char *dummy;
> ++ uint16_t pan_id, short_addr;
> ++ uint8_t chan;
> ++
> ++ if (!cmd->argv[1])
> ++ return IZ_STOP_ERR;
> ++ NLA_PUT_STRING(msg, IEEE802154_ATTR_DEV_NAME, cmd->argv[1]);
> ++
> ++ if (!cmd->argv[2])
> ++ return IZ_STOP_ERR;
> ++ pan_id = strtol(cmd->argv[2], &dummy, 16);
> ++ if (*dummy) {
> ++ printf("Bad PAN ID!\n");
> ++ return IZ_STOP_ERR;
> ++ }
> ++ NLA_PUT_U16(msg, IEEE802154_ATTR_COORD_PAN_ID, pan_id);
> ++
> ++ if (!cmd->argv[3])
> ++ return IZ_STOP_ERR;
> ++ short_addr = strtol(cmd->argv[3], &dummy, 16);
> ++ if (*dummy) {
> ++ printf("Bad short address!\n");
> ++ return IZ_STOP_ERR;
> ++ }
> ++ NLA_PUT_U16(msg, IEEE802154_ATTR_COORD_SHORT_ADDR, short_addr);
> ++
> ++ if (!cmd->argv[4])
> ++ return IZ_STOP_ERR;
> ++ chan = strtol(cmd->argv[4], &dummy, 10);
> ++ if (*dummy) {
> ++ printf("Bad channel number!\n");
> ++ return IZ_STOP_ERR;
> ++ }
> ++ NLA_PUT_U8(msg, IEEE802154_ATTR_CHANNEL, chan);
> ++
> ++ /* set all unneeded attributes to 0*/
> ++ NLA_PUT_U8(msg, IEEE802154_ATTR_PAN_COORD, 0);
> ++ NLA_PUT_U8(msg, IEEE802154_ATTR_BCN_ORD, 0);
> ++ NLA_PUT_U8(msg, IEEE802154_ATTR_SF_ORD, 0);
> ++ NLA_PUT_U8(msg, IEEE802154_ATTR_BAT_EXT, 0);
> ++ NLA_PUT_U8(msg, IEEE802154_ATTR_COORD_REALIGN, 0);
> ++
> ++ return IZ_CONT_OK;
> ++
> ++nla_put_failure:
> ++ return IZ_STOP_ERR;
> ++}
> ++
> ++static iz_res_t set_response(struct iz_cmd *cmd, struct genlmsghdr *ghdr, struct nlattr **attrs)
> ++{
> ++ if (!attrs[IEEE802154_ATTR_SHORT_ADDR] ||
> ++ !attrs[IEEE802154_ATTR_STATUS] )
> ++ return IZ_STOP_ERR;
> ++
> ++ printf("Set PAN ID %04hx, short address %04hx, status %i\n",
> ++ nla_get_u16(attrs[IEEE802154_ATTR_COORD_PAN_ID]),
> ++ nla_get_u16(attrs[IEEE802154_ATTR_SHORT_ADDR]),
> ++ nla_get_u8(attrs[IEEE802154_ATTR_CHANNEL]));
> ++
> ++ return IZ_STOP_OK;
> ++}
> ++
> ++static struct iz_cmd_event set_response_event[] = {
> ++ {
> ++ .call = set_response,
> ++ .nl = IEEE802154_START_CONF,
> ++ },
> ++ {},
> ++};
> ++
> + /************************/
> + /* ASSOCIATE handling */
> + /************************/
> +@@ -473,6 +555,15 @@ const struct iz_module iz_mac = {
> + .response = list_response_event,
> + .finish = list_finish,
> + },
> ++ {
> ++ .name = "set",
> ++ .usage = "<iface> <pan> <addr> <channel>",
> ++ .doc = "Set address, channel and pan for an interface.",
> ++ .nl_cmd = IEEE802154_START_REQ,
> ++ .parse = set_parse,
> ++ .request = set_request,
> ++ .response = set_response_event,
> ++ },
> + {}}
> + };
> +
> +--
> +1.8.2.3
> +
> diff --git a/patches/lowpan-tools-0.3/0007-iz-mac-Handle-return-code-from-set-command.patch b/patches/lowpan-tools-0.3/0007-iz-mac-Handle-return-code-from-set-command.patch
> new file mode 100644
> index 0000000..d4f48ca
> --- /dev/null
> +++ b/patches/lowpan-tools-0.3/0007-iz-mac-Handle-return-code-from-set-command.patch
> @@ -0,0 +1,43 @@
> +From a1d9615adde6d1a568813c24a128273ed755af04 Mon Sep 17 00:00:00 2001
> +From: Alan Ott <alan@signal11.us>
> +Date: Sun, 17 Mar 2013 21:22:52 -0400
> +Subject: [PATCH 7/7] iz-mac: Handle return code from "set" command
> +
> +The iz set command will fail if the PAN ID is invalid. Handle this failure.
> +
> +Signed-off-by: Alan Ott <alan@signal11.us>
> +---
> + src/iz-mac.c | 16 +++++++++-------
> + 1 file changed, 9 insertions(+), 7 deletions(-)
> +
> +diff --git a/src/iz-mac.c b/src/iz-mac.c
> +index be980d6..838229c 100644
> +--- a/src/iz-mac.c
> ++++ b/src/iz-mac.c
> +@@ -315,14 +315,16 @@ nla_put_failure:
> +
> + static iz_res_t set_response(struct iz_cmd *cmd, struct genlmsghdr *ghdr, struct nlattr **attrs)
> + {
> +- if (!attrs[IEEE802154_ATTR_SHORT_ADDR] ||
> +- !attrs[IEEE802154_ATTR_STATUS] )
> ++ uint8_t status;
> ++
> ++ if (!attrs[IEEE802154_ATTR_STATUS])
> + return IZ_STOP_ERR;
> +-
> +- printf("Set PAN ID %04hx, short address %04hx, status %i\n",
> +- nla_get_u16(attrs[IEEE802154_ATTR_COORD_PAN_ID]),
> +- nla_get_u16(attrs[IEEE802154_ATTR_SHORT_ADDR]),
> +- nla_get_u8(attrs[IEEE802154_ATTR_CHANNEL]));
> ++
> ++ status = nla_get_u8(attrs[IEEE802154_ATTR_STATUS]);
> ++ if (status != 0) {
> ++ printf("Operation Failed. Check channel and PAN ID\n");
> ++ return IZ_STOP_ERR;
> ++ }
> +
> + return IZ_STOP_OK;
> + }
> +--
> +1.8.2.3
> +
> diff --git a/patches/lowpan-tools-0.3/series b/patches/lowpan-tools-0.3/series
> index 7f7c24f..1652508 100644
> --- a/patches/lowpan-tools-0.3/series
> +++ b/patches/lowpan-tools-0.3/series
> @@ -1 +1,7 @@
> -0001-Avoid-crashing-in-izcoordinator.patch
> +0001-izoordinator-Fixes-to-error-handling.patch
> +0002-addrdb-fix-include-dependency-and-remove-redefined.patch
> +0003-configure.ac-check-for-python2.x.patch
> +0004-m4-add-py_check_major_version.m4.patch
> +0005-configure.ac-Check-that-the-python-version-is-indeed.patch
> +0006-Allow-to-set-PAN-ID-short-address-and-channel-manual.patch
> +0007-iz-mac-Handle-return-code-from-set-command.patch
> --
> 1.8.2.3
>
>
> --
> ptxdist mailing list
> ptxdist@pengutronix.de
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ptxdist] [PATCH] lowpan-tools: update lowpan-patches
2013-05-13 7:42 ` Michael Olbrich
@ 2013-05-13 8:46 ` Alexander Aring
2013-05-13 12:18 ` Michael Olbrich
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Aring @ 2013-05-13 8:46 UTC (permalink / raw)
To: ptxdist
Hi Michael,
On Mon, May 13, 2013 at 09:42:04AM +0200, Michael Olbrich wrote:
> On Sun, May 12, 2013 at 09:29:39PM +0200, Alexander Aring wrote:
> > Currently there is no way to make a new lowpan-tools release.
> > This patch synchronize the patches from version 0.3 with current
> > git master.
> >
> > Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> > ---
> > .../0001-Avoid-crashing-in-izcoordinator.patch | 139 ---------------------
>
> Is this patch no longer relevant?
>
It's now in upstream and replaced by
0001-izoordinator-Fixes-to-error-handling.patch
> > ...0001-izoordinator-Fixes-to-error-handling.patch | 50 ++++++++
> > ...x-include-dependency-and-remove-redefined.patch | 109 ++++++++++++++++
> > .../0003-configure.ac-check-for-python2.x.patch | 32 +++++
>
> This patch modifies configure.ac. You need to add a link to ../autogen.sh
> so that ptxdist knows to recreate configure.
>
oh yes, I forgot that. Thanks.
Alex
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ptxdist] [PATCH] lowpan-tools: update lowpan-patches
2013-05-13 8:46 ` Alexander Aring
@ 2013-05-13 12:18 ` Michael Olbrich
2013-05-13 12:28 ` Alexander Aring
0 siblings, 1 reply; 5+ messages in thread
From: Michael Olbrich @ 2013-05-13 12:18 UTC (permalink / raw)
To: ptxdist
On Mon, May 13, 2013 at 10:46:49AM +0200, Alexander Aring wrote:
> Hi Michael,
>
> On Mon, May 13, 2013 at 09:42:04AM +0200, Michael Olbrich wrote:
> > On Sun, May 12, 2013 at 09:29:39PM +0200, Alexander Aring wrote:
> > > Currently there is no way to make a new lowpan-tools release.
> > > This patch synchronize the patches from version 0.3 with current
> > > git master.
> > >
> > > Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> > > ---
> > > .../0001-Avoid-crashing-in-izcoordinator.patch | 139 ---------------------
> >
> > Is this patch no longer relevant?
> >
>
> It's now in upstream and replaced by
> 0001-izoordinator-Fixes-to-error-handling.patch
That's not obvious from just looking at the patches. Please add a comment
in the commit message.
Michael
> > > ...0001-izoordinator-Fixes-to-error-handling.patch | 50 ++++++++
> > > ...x-include-dependency-and-remove-redefined.patch | 109 ++++++++++++++++
> > > .../0003-configure.ac-check-for-python2.x.patch | 32 +++++
> >
> > This patch modifies configure.ac. You need to add a link to ../autogen.sh
> > so that ptxdist knows to recreate configure.
> >
> oh yes, I forgot that. Thanks.
>
> Alex
>
> --
> ptxdist mailing list
> ptxdist@pengutronix.de
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ptxdist] [PATCH] lowpan-tools: update lowpan-patches
2013-05-13 12:18 ` Michael Olbrich
@ 2013-05-13 12:28 ` Alexander Aring
0 siblings, 0 replies; 5+ messages in thread
From: Alexander Aring @ 2013-05-13 12:28 UTC (permalink / raw)
To: ptxdist
Hi Michael,
On Mon, May 13, 2013 at 02:18:59PM +0200, Michael Olbrich wrote:
> On Mon, May 13, 2013 at 10:46:49AM +0200, Alexander Aring wrote:
> > Hi Michael,
> >
> > On Mon, May 13, 2013 at 09:42:04AM +0200, Michael Olbrich wrote:
> > > On Sun, May 12, 2013 at 09:29:39PM +0200, Alexander Aring wrote:
> > > > Currently there is no way to make a new lowpan-tools release.
> > > > This patch synchronize the patches from version 0.3 with current
> > > > git master.
> > > >
> > > > Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> > > > ---
> > > > .../0001-Avoid-crashing-in-izcoordinator.patch | 139 ---------------------
> > >
> > > Is this patch no longer relevant?
> > >
> >
> > It's now in upstream and replaced by
> > 0001-izoordinator-Fixes-to-error-handling.patch
>
> That's not obvious from just looking at the patches. Please add a comment
> in the commit message.
>
You are right, I will do that. Sorry :-)
Alex
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-05-13 12:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-12 19:29 [ptxdist] [PATCH] lowpan-tools: update lowpan-patches Alexander Aring
2013-05-13 7:42 ` Michael Olbrich
2013-05-13 8:46 ` Alexander Aring
2013-05-13 12:18 ` Michael Olbrich
2013-05-13 12:28 ` Alexander Aring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox