Re: [PATCH] ifplugd: Allow ENODEV when upping interface for -M

2016-08-29 Thread Jate Sujjavanich
I was finally able to try out the commit in busybox master. The patch
worked.

On Fri, Aug 19, 2016 at 9:40 AM, Denys Vlasenko 
wrote:

> Fixed in git, please try it.
>
> On Thu, Aug 18, 2016 at 10:00 PM, Jate Sujjavanich 
> wrote:
> > I am able to reproduce the issue on my system consistently. I'm using
> > modprobe to remove the driver for g_ether on my ARM system. Using strace
> > reduces the frequency of the bug, but it still occurs.
> >
> > Here's the output from strace:
> >
> > 14:50:53.886676 ioctl(3, SIOCGIFFLAGS, {ifr_name="usb0",
> > ifr_flags=IFF_BROADCAS
> > T|IFF_MULTICAST}) = 0
> > 14:50:53.887140 write(2, "ifplugd(usb0): upping interface\n",
> > 32ifplugd(usb0):
> > upping interface
> > ) = 32
> > 14:50:53.887584 gettimeofday({1471546253, 887734}, NULL) = 0
> > 14:50:53.888011 send(5, "<27>Aug 18 14:50:53 ifplugd(usb0"..., 52,
> > MSG_NOSIGNAL
> > ) = 52
> > 14:50:53.888431 ioctl(3, SIOCSIFFLAGS, {ifr_name="usb0", ???}) = -1
> ENODEV
> > (No
> > such device)
> > 14:50:53.895989 write(2, "ifplugd(usb0): setting interface"...,
> > 62ifplugd(usb0)
> > : setting interface flags failed: No such device
> > ) = 62
> >
> >
> > On Tue, Aug 16, 2016 at 7:52 PM, Denys Vlasenko <
> vda.li...@googlemail.com>
> > wrote:
> >>
> >> On Thu, Aug 11, 2016 at 5:21 PM, Jate Sujjavanich 
> >> wrote:
> >> > The following changes since commit
> >> > 150dc7a2b483b8338a3e185c478b4b23ee884e71:
> >> >
> >> >   ntpd: respond only to client and symmetric active packets
> (2016-08-01
> >> > 20:25:06 +0200)
> >> >
> >> > are available in the git repository at:
> >> >
> >> >   https://github.com/jatedev/busybox work-ifplugd-device-detect
> >> >
> >> > for you to fetch changes up to a5d29d0cc0ff79214465a66fc8cd49
> 757bf72064:
> >> >
> >> >   ifplugd: Allow ENODEV when upping interface for -M (2016-08-11
> >> > 11:09:21
> >> > -0400)
> >> >
> >> > 
> >> > Jate Sujjavanich (1):
> >> >   ifplugd: Allow ENODEV when upping interface for -M
> >> >
> >> >  networking/ifplugd.c |6 +-
> >> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >> >
> >> > diff --git a/networking/ifplugd.c b/networking/ifplugd.c
> >> > index 28c49e2..67251ae 100644
> >> > --- a/networking/ifplugd.c
> >> > +++ b/networking/ifplugd.c
> >> > @@ -359,7 +359,11 @@ static void up_iface(void)
> >> > /* Let user know we mess up with interface */
> >> > bb_error_msg("upping interface");
> >> > if (network_ioctl(SIOCSIFFLAGS, , "setting
> >> > interface flags") < 0)
> >> > -   xfunc_die();
> >> > +   if (errno == ENODEV) {
> >> > +   G.iface_exists = 0;
> >> > +   return;
> >> > +   } else
> >> > +   xfunc_die();
> >> > }
> >>
> >> This makes sense. But...
> >>
> >> set_ifreq_to_ifname();
> >> if (network_ioctl(SIOCGIFFLAGS, , "getting interface
> >> flags") < 0) {
> >> G.iface_exists = 0;
> >> return;
> >> }
> >>
> >> if (!(ifrequest.ifr_flags & IFF_UP)) {
> >> ifrequest.ifr_flags |= IFF_UP;
> >> /* Let user know we mess up with interface */
> >> bb_error_msg("upping interface");
> >> if (network_ioctl(SIOCSIFFLAGS, , "setting
> >> interface flags") < 0) {
> >>
> >>
> >>
> >> I just wonder, how on Earth SIOCGIFFLAGS just above did _not_ fail?
> >> The iface deletion race? Very tight, almost impossible to hit...
> >
> >
>
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Re: Not getting the correct result with SHA3

2016-08-29 Thread Marlon Smith
Thanks for the responses guys.  Looks like this is all figured out now.

On Mon, 2016-08-29 at 20:44 +0300, Lauri Kasanen wrote:

> On Mon, Aug 29, 2016, at 15:10, Denys Vlasenko wrote:
> > I guess this is an example why it makes sense to wait for general
> > adoption of the tool in common distros before adding it to busybox.
> > 
> > The bug was that SHA3 uses 0110*1 padding (raw Keccak uses 10*1).
> > Easy to fix.
> > 
> > sha3sum which I found on Fedora is a Perl script (oookay...),
> > it defaults to SHA3-224 and has an -a BITS option.
> > 
> > Fixed both in git. Please try it.
> 
> Confirmed working on x86_64. Thanks Denys!
> 
> - Lauri
> 


___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Re: Not getting the correct result with SHA3

2016-08-29 Thread Lauri Kasanen
On Mon, Aug 29, 2016, at 15:10, Denys Vlasenko wrote:
> I guess this is an example why it makes sense to wait for general
> adoption of the tool in common distros before adding it to busybox.
> 
> The bug was that SHA3 uses 0110*1 padding (raw Keccak uses 10*1).
> Easy to fix.
> 
> sha3sum which I found on Fedora is a Perl script (oookay...),
> it defaults to SHA3-224 and has an -a BITS option.
> 
> Fixed both in git. Please try it.

Confirmed working on x86_64. Thanks Denys!

- Lauri

-- 
http://www.fastmail.com - The professional email service

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[PATCH] volume_id: Add support for UBIFS

2016-08-29 Thread Serj Kalichev
Signed-off-by: Serj Kalichev 
---
 util-linux/volume_id/get_devname.c|   6 +-
 util-linux/volume_id/ubifs.c  | 125 ++
 util-linux/volume_id/volume_id.c  |   3 +
 util-linux/volume_id/volume_id_internal.h |   2 +
 4 files changed, 135 insertions(+), 1 deletion(-)
 create mode 100644 util-linux/volume_id/ubifs.c

diff --git a/util-linux/volume_id/get_devname.c 
b/util-linux/volume_id/get_devname.c
index 6b97df1..0d554a2 100644
--- a/util-linux/volume_id/get_devname.c
+++ b/util-linux/volume_id/get_devname.c
@@ -107,7 +107,11 @@ uuidcache_check_device(const char *device,
int depth UNUSED_PARAM)
 {
/* note: this check rejects links to devices, among other nodes */
-   if (!S_ISBLK(statbuf->st_mode))
+   if (!S_ISBLK(statbuf->st_mode)
+#if ENABLE_FEATURE_VOLUMEID_UBIFS
+   && !(S_ISCHR(statbuf->st_mode) && !strncmp(bb_basename(device), 
"ubi", 3))
+#endif
+   )
return TRUE;
 
/* Users report that mucking with floppies (especially non-present
diff --git a/util-linux/volume_id/ubifs.c b/util-linux/volume_id/ubifs.c
new file mode 100644
index 000..13604ec
--- /dev/null
+++ b/util-linux/volume_id/ubifs.c
@@ -0,0 +1,125 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2012 S-G Bergh 
+ *
+ * Licensed under GPLv2, see file LICENSE in this source tree.
+ */
+
+//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_UBIFS) += ubifs.o
+
+//config:
+//config:config FEATURE_VOLUMEID_UBIFS
+//config:  bool "UBIFS filesystem"
+//config:  default y
+//config:  depends on VOLUMEID
+//config:  help
+//config:UBIFS (Unsorted Block Image File System) is a file
+//config:system for use with raw flash memory media.
+//config:
+
+#include "volume_id_internal.h"
+
+#define UBIFS_NODE_MAGIC  0x06101831
+
+/*
+ * struct ubifs_ch - common header node.
+ * @magic: UBIFS node magic number (%UBIFS_NODE_MAGIC)
+ * @crc: CRC-32 checksum of the node header
+ * @sqnum: sequence number
+ * @len: full node length
+ * @node_type: node type
+ * @group_type: node group type
+ * @padding: reserved for future, zeroes
+ *
+ * Every UBIFS node starts with this common part. If the node has a key, the
+ * key always goes next.
+ */
+struct ubifs_ch {
+   uint32_t magic;
+   uint32_t crc;
+   uint64_t sqnum;
+   uint32_t len;
+   uint8_t node_type;
+   uint8_t group_type;
+   uint8_t padding[2];
+} PACKED;
+
+/*
+ * struct ubifs_sb_node - superblock node.
+ * @ch: common header
+ * @padding: reserved for future, zeroes
+ * @key_hash: type of hash function used in keys
+ * @key_fmt: format of the key
+ * @flags: file-system flags (%UBIFS_FLG_BIGLPT, etc)
+ * @min_io_size: minimal input/output unit size
+ * @leb_size: logical eraseblock size in bytes
+ * @leb_cnt: count of LEBs used by file-system
+ * @max_leb_cnt: maximum count of LEBs used by file-system
+ * @max_bud_bytes: maximum amount of data stored in buds
+ * @log_lebs: log size in logical eraseblocks
+ * @lpt_lebs: number of LEBs used for lprops table
+ * @orph_lebs: number of LEBs used for recording orphans
+ * @jhead_cnt: count of journal heads
+ * @fanout: tree fanout (max. number of links per indexing node)
+ * @lsave_cnt: number of LEB numbers in LPT's save table
+ * @fmt_version: UBIFS on-flash format version
+ * @default_compr: default compression algorithm (%UBIFS_COMPR_LZO, etc)
+ * @padding1: reserved for future, zeroes
+ * @rp_uid: reserve pool UID
+ * @rp_gid: reserve pool GID
+ * @rp_size: size of the reserved pool in bytes
+ * @padding2: reserved for future, zeroes
+ * @time_gran: time granularity in nanoseconds
+ * @uuid: UUID generated when the file system image was created
+ * @ro_compat_version: UBIFS R/O compatibility version
+ */
+struct ubifs_sb_node {
+   struct ubifs_ch ch;
+   uint8_t padding[2];
+   uint8_t key_hash;
+   uint8_t key_fmt;
+   uint32_t flags;
+   uint32_t min_io_size;
+   uint32_t leb_size;
+   uint32_t leb_cnt;
+   uint32_t max_leb_cnt;
+   uint64_t max_bud_bytes;
+   uint32_t log_lebs;
+   uint32_t lpt_lebs;
+   uint32_t orph_lebs;
+   uint32_t jhead_cnt;
+   uint32_t fanout;
+   uint32_t lsave_cnt;
+   uint32_t fmt_version;
+   uint16_t default_compr;
+   uint8_t padding1[2];
+   uint32_t rp_uid;
+   uint32_t rp_gid;
+   uint64_t rp_size;
+   uint32_t time_gran;
+   uint8_t uuid[16];
+   uint32_t ro_compat_version;
+/*
+   uint8_t padding2[3968];
+*/
+} PACKED;
+
+int FAST_FUNC volume_id_probe_ubifs(struct volume_id *id /*,uint64_t off*/)
+{
+#define off ((uint64_t)0)
+   struct ubifs_sb_node *sb;
+
+   dbg("UBIFS: probing at offset 0x%llx", (unsigned long long) off);
+   sb = volume_id_get_buffer(id, off, sizeof(struct ubifs_sb_node));
+   if (!sb)
+   return -1;
+
+  

Re: Not getting the correct result with SHA3

2016-08-29 Thread Denys Vlasenko
On Sat, Aug 27, 2016 at 10:31 AM, Lauri Kasanen  wrote:
> On Fri, Aug 26, 2016, at 21:28, Marlon Smith wrote:
>> Hi everyone,
>>
>> I'm using Busybox version 1.23.1 and it seems like sha3sum is giving an
>> incorrect result.
>>
>> For example if I run this command:
>>
>> echo "abc" | sha3sum
>>
>> I get an incorrect result:
>>
>> e0a651904afe783ec83eeb586a2e602a09c43a3c6d795549ed7a58caae661074beaccd16d470ce4eac3ba98feee94bead3916ef4a75c1501
>> 1f07df348ce7a9e7
>>
>> I'm running BusyBox on an i.MX6 embedded Linux system based on Yocto.
>>
>> Does anyone know why this could be the case?
>
> Hi,
>
> We're aware. SHA3 changed after we made the applet, IIRC in the padding
> bits added after the data. Patches welcome, I'm really busy.

I guess this is an example why it makes sense to wait for general
adoption of the tool in common distros before adding it to busybox.

The bug was that SHA3 uses 0110*1 padding (raw Keccak uses 10*1).
Easy to fix.

sha3sum which I found on Fedora is a Perl script (oookay...),
it defaults to SHA3-224 and has an -a BITS option.

Fixed both in git. Please try it.
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: # CONFIG_BUSYBOX is not set: breakage on master

2016-08-29 Thread Cristian Ionescu-Idbohrn
On Mon, 29 Aug 2016, Denys Vlasenko wrote:
>
> Yes, it is intended too.

Alright.

> Propose a change to the help text of this option which would
> make it clearer.

Well, something along these lines:

"Disabling this will remove the banner and applet list text when
running the busybox command without options or with options '--help',
'--list[-full]'.


Cheers,

-- 
Cristian
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox