Chan Kim | 31 Jul 15:53 2014
Picon
Picon

busybox 1.20.2 buildig error

Greetings,

Hi, I'm using busybox 1.20.2 ( I cannot change it now),
this evening I added networking support / route using menuconfig. Then during the build I get many errors.
The reason is because networking/route.c file contains #include <net/route.h> and #include <net/if.h>
which are kernel headers.
(There is no busybox header file by those names. They are under linux/include/. in my cross-compiler
kernel header)

I found this page http://osdir.com/ml/linux.busybox/2004-02/msg00307.html but the location is
different and it's long time ago.
What is the best method I can get rid of these errors? I need to add route commands.
Thanks you!
regards,

Chan Kim
Bartosz Golaszewski | 30 Jul 19:10 2014
Picon

[PATCH] unit-tests: optionally show elapsed time

File bbunit.c doesn't compile with WANT_TIMING enabled due
to a missing comma at line 80. This patch fixes it, adds a
config option for elapsed time display and replaces the custom
timeval_diff() function with standard timersub() macro.

Signed-off-by: Bartosz Golaszewski <bartekgola <at> gmail.com>
---
 Config.in      |  8 ++++++++
 libbb/bbunit.c | 22 ++++------------------
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/Config.in b/Config.in
index b83beb5..81ea26d 100644
--- a/Config.in
+++ b/Config.in
 <at>  <at>  -683,6 +683,14  <at>  <at>  config UNIT_TEST
 	  test cases) as a Busybox applet. This results in bigger code, so you
 	  probably don't want this option in production builds.

+config UNIT_TEST_TIMER
+	bool "Show elapsed time for unit-tests"
+	default n
+	depends on UNIT_TEST
+	help
+	  Say Y here if you want the unit-test framework to show the time
+	  spent on test execution.
+
 config WERROR
 	bool "Abort compilation on any warning"
 	default n
(Continue reading)

Thomas De Schampheleire | 29 Jul 10:45 2014
Picon

[PATCH 0 of 2] grep: fix -r on symlink to dir


This small series fixes 'grep -r' on a symlink to a directory: grep should
recurse in the symlinked directory.

As noted on the first patch, I split the test from the fix for easier
verification, but if you prefer I can fold both together.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire <at> gmail.com>

---
 findutils/grep.c     |  2 +-
 testsuite/grep.tests |  8 ++++++++
 2 files changed, 9 insertions(+), 1 deletions(-)
Michael Tokarev | 28 Jul 08:05 2014
Picon

[PATCH] iproute: support onelink route option and print route flags

Signed-off-by: Michael Tokarev <mjt <at> tls.msk.ru>
---
 networking/libiproute/iproute.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index ec4d8ba..273f6fe 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
 <at>  <at>  -298,6 +298,19  <at>  <at>  static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM,
 	if (tb[RTA_PRIORITY]) {
 		printf(" metric %d ", *(uint32_t*)RTA_DATA(tb[RTA_PRIORITY]));
 	}
+	if (r->rtm_flags & RTNH_F_DEAD) {
+		printf("dead ");
+	}
+	if (r->rtm_flags & RTNH_F_ONLINK) {
+		printf("onlink ");
+	}
+	if (r->rtm_flags & RTNH_F_PERVASIVE) {
+		printf("pervasive ");
+	}
+	if (r->rtm_flags & RTM_F_NOTIFY) {
+		printf("notify ");
+	}
+
 	if (r->rtm_family == AF_INET6) {
 		struct rta_cacheinfo *ci = NULL;
 		if (tb[RTA_CACHEINFO]) {
 <at>  <at>  -330,7 +343,7  <at>  <at>  static int iproute_modify(int cmd, unsigned flags, char **argv)
(Continue reading)

Oscar Ravadilla | 28 Jul 00:11 2014
Picon

[PATCH] tftp: Fix tftp -put issue with ECMP configured routes.

With the latest linux kernel, route caching has been removed.
This breaks tftp because routes can now change everytime.
---
 networking/tftp.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/networking/tftp.c b/networking/tftp.c
index 630fdaf..a1627bd 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
 <at>  <at>  -254,9 +254,12  <at>  <at>  static int tftp_protocol(
 	 */
 	char *xbuf = xmalloc(io_bufsize);
 	char *rbuf = xmalloc(io_bufsize);
+	struct sockaddr sa_bind_address;

 	socket_fd = xsocket(peer_lsa->u.sa.sa_family, SOCK_DGRAM, 0);
 	setsockopt_reuseaddr(socket_fd);
+	memset(&sa_bind_address, 0, sizeof(sa_bind_address));
+	xbind(socket_fd, &sa_bind_address, sizeof(sa_bind_address));

 	if (!ENABLE_TFTP || our_lsa) { /* tftpd */
 		/* Create a socket which is:
 <at>  <at>  -510,11 +513,6  <at>  <at>  static int tftp_protocol(
 				our_lsa = ((void*)(ptrdiff_t)-1); /* not NULL */
 				len = recvfrom(socket_fd, rbuf, io_bufsize, 0,
 						&peer_lsa->u.sa, &peer_lsa->len);
-				/* Our first dgram went to port 69
-				 * but reply may come from different one.
-				 * Remember and use this new port (and IP) */
(Continue reading)

Guilherme Maciel Ferreira | 26 Jul 19:37 2014
Picon

[PATCH 1/3] tail: turn i to unsigned integer

The variable i is used only to index and to be assigned to other unsigned
integers.

Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira <at> gmail.com>
---
 coreutils/tail.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/coreutils/tail.c b/coreutils/tail.c
index e352ab6..c44aeb8 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
 <at>  <at>  -100,7 +100,8  <at>  <at>  int tail_main(int argc, char **argv)
 	size_t tailbufsize;
 	unsigned header_threshhold = 1;
 	unsigned nfiles;
-	int i, opt;
+	unsigned i;
+	int opt;

 	int *fds;
 	const char *fmt;
 <at>  <at>  -161,7 +162,7  <at>  <at>  int tail_main(int argc, char **argv)
 		}
 		fds[nfiles] = fd;
 		argv[nfiles++] = argv[i];
-	} while (++i < argc);
+	} while (++i < (unsigned) argc);

 	if (!nfiles)
(Continue reading)

Aaro Koskinen | 26 Jul 18:53 2014
Picon
Picon

[PATCH 1/2] tftp: fix off by one error

RFC 2347 allows requests to be up to 512 bytes.

Signed-off-by: Aaro Koskinen <aaro.koskinen <at> iki.fi>
---
 networking/tftp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/networking/tftp.c b/networking/tftp.c
index 630fdaf..b91ef5b 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
 <at>  <at>  -799,7 +799,7  <at>  <at>  int tftpd_main(int argc UNUSED_PARAM, char **argv)

 	error_msg = "malformed packet";
 	opcode = ntohs(*(uint16_t*)G.block_buf);
-	if (result < 4 || result >= sizeof(G.block_buf)
+	if (result < 4 || result > sizeof(G.block_buf)
 	 || G.block_buf[result-1] != '\0'
 	 || (IF_FEATURE_TFTP_PUT(opcode != TFTP_RRQ) /* not download */
 	     IF_GETPUT(&&)
--

-- 
2.0.0
Nick Stoughton | 25 Jul 21:36 2014

[PATCH] Support ISO 8601 format dates for utilities such as touch

POSIX specifies the -d option to touch as:
-d  date_time
Use the specified date_time instead of the current time.
The option-argument shall be a string of the form:
YYYY-MM-DDThh:mm:SS[.frac][tz]
or:

YYYY-MM-DDThh:mm:SS[,frac][tz]
where:

YYYY are at least four decimal digits giving the year.

MM, DD, hh, mm, and SS are as with -t time.

T is the time designator, and can be replaced by a single <space>.

[.frac] and [,frac] are either empty, or a <period> ( '.' ) or a <comma>
( ',' ) respectively, followed by one or more decimal digits, specifying
a fractional second.

[tz] is either empty, signifying local time, or the letter 'Z', signifying
UTC. If [tz] is empty, the resulting time shall be affected by the value
of the TZ environment variable.

This patch adds support for 'T' as the time designator and supports tz.
It does not implement fractional seconds. The parse_datestr() function 
is used in both touch and date, so both these utilities benefit.
---
 libbb/time.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/libbb/time.c b/libbb/time.c
index aa19a47..820b1f9 100644
--- a/libbb/time.c
+++ b/libbb/time.c
<at> <at> -7,10 +7,12 <at> <at>
  * Licensed under GPLv2, see file LICENSE in this source tree.
  */
 #include "libbb.h"
+#include "rtc_.h"
 
 void FAST_FUNC parse_datestr(const char *date_str, struct tm *ptm)
 {
  char end = '\0';
+ char sep = '\0';
  const char *last_colon = strrchr(date_str, ':');
 
  if (last_colon != NULL) {
<at> <at> -41,11 +43,11 <at> <at> void FAST_FUNC parse_datestr(const char *date_str, struct tm *ptm)
  &ptm->tm_mon, &ptm->tm_mday,
  &ptm->tm_hour, &ptm->tm_min,
  &end) >= 5
- /* yyyy-mm-dd HH:MM */
- || sscanf(date_str, "%u-%u-%u %u:%u%c", &ptm->tm_year,
- &ptm->tm_mon, &ptm->tm_mday,
+ /* yyyy-mm-dd HH:MM (also accepts ISO-8601 format dates) */
+ || sscanf(date_str, "%u-%u-%u%c%u:%u%c", &ptm->tm_year,
+ &ptm->tm_mon, &ptm->tm_mday, &sep,
  &ptm->tm_hour, &ptm->tm_min,
- &end) >= 5
+ &end) >= 6 && (sep == ' ' || sep == 'T')
  ) {
  ptm->tm_year -= 1900; /* Adjust years */
  ptm->tm_mon -= 1; /* Adjust month from 1-12 to 0-11 */
<at> <at> -65,6 +67,11 <at> <at> void FAST_FUNC parse_datestr(const char *date_str, struct tm *ptm)
  /* xxx:SS */
  if (sscanf(last_colon + 1, "%u%c", &ptm->tm_sec, &end) == 1)
  end = '\0';
+ if (end == 'Z') {
+ time_t utc = rtc_tm2time(ptm, 1);
+ localtime_r(&utc, ptm);
+ end = '\0';
+ }
  /* else end != NUL and we error out */
  }
  } else
-- 
1.9.3

Nick Stoughton
Aether Things Inc 
San Francisco
+1 (510) 388 1413
 
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Natanael Copa | 25 Jul 15:47 2014
Picon

[PATCH] diff: add support for --no-dereference

Add flag for not following symlinks when recursing

function                                             old     new   delta
.rodata                                             7934    7967     +33
diff_longopts                                        253     270     +17
packed_usage                                        1704    1720     +16
diff_main                                           1665    1662      -3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 66/-3)              Total: 63 bytes

Signed-off-by: Natanael Copa <ncopa <at> alpinelinux.org>
---
 This is needed for Alpine Linux: http://bugs.alpinelinux.org/issues/2847

 editors/diff.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/editors/diff.c b/editors/diff.c
index a78a0ee..a0203af 100644
--- a/editors/diff.c
+++ b/editors/diff.c
 <at>  <at>  -117,6 +117,9  <at>  <at> 
 //usage:     "\n	-N	Treat absent files as empty"
 //usage:     "\n	-q	Output only whether files differ"
 //usage:     "\n	-r	Recurse"
+//usage:        IF_LONG_OPTS(
+//usage:     "\n        --no-dereference Don't follow symlinks"
+//usage:        )
 //usage:     "\n	-S	Start with FILE when comparing directories"
 //usage:     "\n	-T	Make tabs line up by prefixing a tab when necessary"
 //usage:     "\n	-s	Report when two files are the same"
 <at>  <at>  -157,6 +160,7  <at>  <at>  enum {                  /* Commandline flags */
 	FLAG_p,         /* not implemented */
 	FLAG_B,
 	FLAG_E,         /* not implemented */
+	FLAG_no_deref,
 };
 #define FLAG(x) (1 << FLAG_##x)

 <at>  <at>  -869,7 +873,8  <at>  <at>  static void diffdir(char *p[2], const char *s_start)
 		 * Using list.len to specify its length,
 		 * add_to_dirlist will remove it. */
 		list[i].len = strlen(p[i]);
-		recursive_action(p[i], ACTION_RECURSE | ACTION_FOLLOWLINKS,
+		recursive_action(p[i], ACTION_RECURSE |
+			(option_mask32 & FLAG(no_deref)) ? 0 : ACTION_FOLLOWLINKS,
 				add_to_dirlist, skip_dir, &list[i], 0);
 		/* Sort dl alphabetically.
 		 * GNU diff does this ignoring any number of trailing dots.
 <at>  <at>  -966,6 +971,7  <at>  <at>  static const char diff_longopts[] ALIGN1 =
 	"report-identical-files\0"   No_argument       "s"
 	"starting-file\0"            Required_argument "S"
 	"minimal\0"                  No_argument       "d"
+	"no-dereference\0"           No_argument       "\xff"
 	;
 #endif

--

-- 
2.0.3
oscar ravadilla | 25 Jul 01:14 2014
Picon

tftp: tftp -put with ECMP route fails

Hi,


When multi-path routing like ECMP is configured, tftp -put fails because in the latest linux kernel route caching has been removed and kernel selects a different route for each transaction. The tftp is receiving ICMP errors from the tftp server because the route gets changed in every transaction.


Has anybody seen this issue before?


The below changes seems to fix the issue:


diff --git a/networking/tftp.c b/networking/tftp.c

index 630fdaf..a1627bd 100644

--- a/networking/tftp.c

+++ b/networking/tftp.c

<at> <at> -254,9 +254,12 <at> <at> static int tftp_protocol(

         */

        char *xbuf = xmalloc(io_bufsize);

        char *rbuf = xmalloc(io_bufsize);

+       struct sockaddr sa_bind_address;

 

        socket_fd = xsocket(peer_lsa->u.sa.sa_family, SOCK_DGRAM, 0);

        setsockopt_reuseaddr(socket_fd);

+       memset(&sa_bind_address, 0, sizeof(sa_bind_address));

+       xbind(socket_fd, &sa_bind_address, sizeof(sa_bind_address));

 

        if (!ENABLE_TFTP || our_lsa) { /* tftpd */

                /* Create a socket which is:

<at> <at> -510,11 +513,6 <at> <at> static int tftp_protocol(

                                our_lsa = ((void*)(ptrdiff_t)-1); /* not NULL */

                                len = recvfrom(socket_fd, rbuf, io_bufsize, 0,

                                                &peer_lsa->u.sa, &peer_lsa->len);

-                               /* Our first dgram went to port 69

-                                * but reply may come from different one.

-                                * Remember and use this new port (and IP) */

-                               if (len >= 0)

-                                       xconnect(socket_fd, &peer_lsa->u.sa, peer_lsa->len);

                        } else {

                                /* tftpd, or not the very first packet:

                                 * socket is connect()ed, can just read from it. */



NOTICE: This message contains privileged and confidential
information intended only for the use of the addressee
named above. If you are not the intended recipient of
this message you are hereby notified that you must not
disseminate, copy or take any action in reliance on it.
If you have received this message in error please
notify Allied Telesis Labs Ltd immediately.
Any views expressed in this message are those of the
individual sender, except where the sender has the
authority to issue and specifically states them to
be the views of Allied Telesis Labs.

 

_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Picon

Old ipv6 patch still necessary?

Hello,
I have a questions about the implementation of busybox. I'm one of the
Android developer from the firewall project AFWall+ and actually we
use an ipv6_route.h patch from Tias Guns.

Project:

https://github.com/ukanth/afwall

Patch (original designed by Tias Guns <tias <at> ulyssis.org>)

From c04d001c962e756d152abc1dbd58edfdbfee45a1 Mon Sep 17 00:00:00 2001
From: Tias Guns <tias <at> ulyssis.org>
Date: Mon, 19 Mar 2012 18:24:29 +0000
Subject: [PATCH] fix ipv6, add ipv6_route.h
from 'in6_rtmsg' by Dan Drown
"in6_rtmsg defined in linux/ipv6_route.h"
http://dan.drown.org/android/src/busybox/
---
 include/linux/ipv6_route.h | 58 ++++++++++++++++++++++++++++++++++++++++++++
 networking/ifconfig.c | 2 +
 networking/route.c | 2 +
 3 files changed, 62 insertions(+), 0 deletions(-)
 create mode 100644 include/linux/ipv6_route.h
diff --git a/include/linux/ipv6_route.h b/include/linux/ipv6_route.h
new file mode 100644
index 0000000..144875d
--- /dev/null
+++ b/include/linux/ipv6_route.h
 <at>  <at>  -0,0 +1,58  <at>  <at> 
+/*
+ * Linux INET6 implementation
+ *
+ * Authors:
+ * Pedro Roque <roque <at> di.fc.ul.pt>
+ *
+ * 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; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _LINUX_IPV6_ROUTE_H
+#define _LINUX_IPV6_ROUTE_H
+
+#include <linux/types.h>
+
+#define RTF_DEFAULT 0x00010000 /* default - learned via ND */
+#define RTF_ALLONLINK 0x00020000 /* (deprecated and will be removed)
+ fallback, no routers on link */
+#define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */
+#define RTF_PREFIX_RT 0x00080000 /* A prefix only route - RA */
+#define RTF_ANYCAST 0x00100000 /* Anycast */
+
+#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */
+#define RTF_EXPIRES 0x00400000
+
+#define RTF_ROUTEINFO 0x00800000 /* route information - RA */
+
+#define RTF_CACHE 0x01000000 /* cache entry */
+#define RTF_FLOW 0x02000000 /* flow significant route */
+#define RTF_POLICY 0x04000000 /* policy route */
+
+#define RTF_PREF(pref) ((pref) << 27)
+#define RTF_PREF_MASK 0x18000000
+
+#define RTF_LOCAL 0x80000000
+
+
+struct in6_rtmsg {
+ struct in6_addr rtmsg_dst;
+ struct in6_addr rtmsg_src;
+ struct in6_addr rtmsg_gateway;
+ __u32 rtmsg_type;
+ __u16 rtmsg_dst_len;
+ __u16 rtmsg_src_len;
+ __u32 rtmsg_metric;
+ unsigned long rtmsg_info;
+ __u32 rtmsg_flags;
+ int rtmsg_ifindex;
+};
+
+#define RTMSG_NEWDEVICE 0x11
+#define RTMSG_DELDEVICE 0x12
+#define RTMSG_NEWROUTE 0x21
+#define RTMSG_DELROUTE 0x22
+
+#endif
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index b6604f5..12e8198 100644
--- a/networking/ifconfig.c
+++ b/networking/ifconfig.c
 <at>  <at>  -79,12 +79,14  <at>  <at> 
 #endif
 #if ENABLE_FEATURE_IPV6
+#ifndef __BIONIC__
 struct in6_ifreq {
 struct in6_addr ifr6_addr;
 uint32_t ifr6_prefixlen;
 int ifr6_ifindex;
 };
 #endif
+#endif
 /*
 * Here are the bit masks for the "flags" member of struct options below.
diff --git a/networking/route.c b/networking/route.c
index b7b5a02..a060eb2 100644
--- a/networking/route.c
+++ b/networking/route.c
 <at>  <at>  -35,6 +35,8  <at>  <at> 
 #include <net/route.h>
 #include <net/if.h>
+#include <linux/in6.h>
+#include <linux/ipv6_route.h>
 #include "libbb.h"
 #include "inet_common.h"
--
1.7.0.4

My question is now, do we still need this patch? Or is this not
anymore necessary? Or is there a better way to handle it?

Thanks for a answer!

Gmane