Bernhard Reutner-Fischer | 27 Mar 18:23 2015
Picon

Re: Connect to telnet with another user

On March 27, 2015 4:02:06 PM GMT+01:00, Alexis Guilloteau <guilloteau <at> gmail.com> wrote:
>Hi,
>
>I looked at the cryptpw and mkpasswd function in busybox.
>It seems they are encrypting a string of characters but don't actually
>chnage the password.
>I must take the result of mkpasswd and edit shadow ? If yes can i
>simply
>write into it :
>
>username:passwdencrypted
>
>or do i have to write all of this ?
>
>username:passwdencrypted:last:may:must:warn:expire:disable:reserved

The latter. See man 5 passwd.
Alternatively just see (in your booted image) passwd --help
I.e. something like
passwd telnet
and enter the new passwd for user telnet.

HTH,
>
>2015-03-27 9:34 GMT+01:00 Bernhard Reutner-Fischer
><rep.dot.nop <at> gmail.com>:
>
>> On March 26, 2015 11:40:59 AM GMT+01:00, Baruch Siach
><baruch <at> tkos.co.il>
>> wrote:
(Continue reading)

Bastian Bittorf | 27 Mar 17:42 2015

minor error in applet 'route'

test with 1.22.1 and HEAD:

when quering 'route -n' with an empty table
(e.g. UML) it does not output 'bb_msg_read_error'
but:

root <at> UML:/ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
route: fscanf

i was wondering where this 'fscanf' was coming from in my logs 8-)
the code in question starts at line 509 in networking/route.c
but is not obvious to me...maybe somebody can see it.

bye, bastian
Michael Sumulong | 26 Mar 17:25 2015
Picon

Re: ifenslave / ifupdown bonding support

Ok that looks promising.

So for pre-down I'd add right after the pre-up line?:
pre-down ifenslave -d bond eth4 eth9


On Thu, Mar 26, 2015 at 11:43 AM, Bernhard Reutner-Fischer <rep.dot.nop <at> gmail.com> wrote:
On 26 March 2015 at 14:57, Michael Sumulong <msumulong <at> gmail.com> wrote:
> I am currently using BusyBox 1.22.1 and would like to be able to setup
> network interface bonding via my /etc/network/interfaces file but I'm not
> sure if there's any support for bonding in ifupdown.c. Can anyone confirm
> this is true or am I missing something?

I suggest you do that with pre-up and post-down
Maybe something like this works already?:

auto bond0
iface bond0 inet static
        address 10.0.0.77
        netmask 255.255.255.0
        gateway 10.0.0.1
        pre-up ifenslave bond0 eth4 eth9

echo "alias bond* bonding" >> /etc/modprobe.d/bonding.conf

HTH,

_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Michael Sumulong | 26 Mar 14:57 2015
Picon

ifenslave / ifupdown bonding support

I am currently using BusyBox 1.22.1 and would like to be able to setup network interface bonding via my /etc/network/interfaces file but I'm not sure if there's any support for bonding in ifupdown.c. Can anyone confirm this is true or am I missing something?

_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Bernhard Reutner-Fischer | 26 Mar 11:57 2015
Picon

[PATCH] *: Switch to POSIX utmpx API

UTMP is SVID legacy, UTMPX is mandated by POSIX.

Glibc and uClibc have identical layout of UTMP and UTMPX, both of these
libc treat _PATH_UTMPX as _PATH_UTMP so from a user-perspective nothing
changes except the names of the API entrypoints.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop <at> gmail.com>
---
 coreutils/who.c        |  8 ++++----
 include/libbb.h        |  2 +-
 init/halt.c            |  4 ++--
 libbb/utmp.c           | 44 ++++++++++++++++++++++----------------------
 miscutils/last.c       |  8 ++++----
 miscutils/last_fancy.c | 16 ++++++++++------
 miscutils/runlevel.c   | 12 ++++++------
 miscutils/wall.c       |  8 ++++----
 procps/uptime.c        |  6 +++---
 9 files changed, 56 insertions(+), 52 deletions(-)

diff --git a/coreutils/who.c b/coreutils/who.c
index f955ce6..8337212 100644
--- a/coreutils/who.c
+++ b/coreutils/who.c
 <at>  <at>  -73,7 +73,7  <at>  <at>  static void idle_string(char *str6, time_t t)
 int who_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int who_main(int argc UNUSED_PARAM, char **argv)
 {
-	struct utmp *ut;
+	struct utmpx *ut;
 	unsigned opt;
 	int do_users = (ENABLE_USERS && (!ENABLE_WHO || applet_name[0] == 'u'));
 	const char *fmt = "%s";
 <at>  <at>  -83,8 +83,8  <at>  <at>  int who_main(int argc UNUSED_PARAM, char **argv)
 	if (opt & 2) // -H
 		printf("USER\t\tTTY\t\tIDLE\tTIME\t\t HOST\n");

-	setutent();
-	while ((ut = getutent()) != NULL) {
+	setutxent();
+	while ((ut = getutxent()) != NULL) {
 		if (ut->ut_user[0]
 		 && ((opt & 1) || ut->ut_type == USER_PROCESS)
 		) {
 <at>  <at>  -126,6 +126,6  <at>  <at>  int who_main(int argc UNUSED_PARAM, char **argv)
 	if (do_users)
 		bb_putchar('\n');
 	if (ENABLE_FEATURE_CLEAN_UP)
-		endutent();
+		endutxent();
 	return EXIT_SUCCESS;
 }
diff --git a/include/libbb.h b/include/libbb.h
index 26b6868..0f8363b 100644
--- a/include/libbb.h
+++ b/include/libbb.h
 <at>  <at>  -84,7 +84,7  <at>  <at> 
 # include <selinux/av_permissions.h>
 #endif
 #if ENABLE_FEATURE_UTMP
-# include <utmp.h>
+# include <utmpx.h>
 #endif
 #if ENABLE_LOCALE_SUPPORT
 # include <locale.h>
diff --git a/init/halt.c b/init/halt.c
index 7974adb..ad12d91 100644
--- a/init/halt.c
+++ b/init/halt.c
 <at>  <at>  -74,7 +74,7  <at>  <at> 

 static void write_wtmp(void)
 {
-	struct utmp utmp;
+	struct utmpx utmp;
 	struct utsname uts;
 	/* "man utmp" says wtmp file should *not* be created automagically */
 	/*if (access(bb_path_wtmp_file, R_OK|W_OK) == -1) {
 <at>  <at>  -88,7 +88,7  <at>  <at>  static void write_wtmp(void)
 	utmp.ut_line[0] = '~'; utmp.ut_line[1] = '~'; /* = strcpy(utmp.ut_line, "~~"); */
 	uname(&uts);
 	safe_strncpy(utmp.ut_host, uts.release, sizeof(utmp.ut_host));
-	updwtmp(bb_path_wtmp_file, &utmp);
+	updwtmpx(bb_path_wtmp_file, &utmp);
 }
 #else
 #define write_wtmp() ((void)0)
diff --git a/libbb/utmp.c b/libbb/utmp.c
index 8ad9ba2..bd07670 100644
--- a/libbb/utmp.c
+++ b/libbb/utmp.c
 <at>  <at>  -16,7 +16,7  <at>  <at>  static void touch(const char *filename)

 void FAST_FUNC write_new_utmp(pid_t pid, int new_type, const char *tty_name, const char *username,
const char *hostname)
 {
-	struct utmp utent;
+	struct utmpx utent;
 	char *id;
 	unsigned width;

 <at>  <at>  -45,17 +45,17  <at>  <at>  void FAST_FUNC write_new_utmp(pid_t pid, int new_type, const char *tty_name, con
 		tty_name += 3;
 	strncpy(id, tty_name, width);

-	touch(_PATH_UTMP);
-	//utmpname(_PATH_UTMP);
-	setutent();
+	touch(_PATH_UTMPX);
+	//utmpxname(_PATH_UTMPX);
+	setutxent();
 	/* Append new one (hopefully, unless we collide on ut_id) */
-	pututline(&utent);
-	endutent();
+	pututxline(&utent);
+	endutxent();

 #if ENABLE_FEATURE_WTMP
 	/* "man utmp" says wtmp file should *not* be created automagically */
 	/*touch(bb_path_wtmp_file);*/
-	updwtmp(bb_path_wtmp_file, &utent);
+	updwtmpx(bb_path_wtmp_file, &utent);
 #endif
 }

 <at>  <at>  -64,17 +64,17  <at>  <at>  void FAST_FUNC write_new_utmp(pid_t pid, int new_type, const char *tty_name, con
  */
 void FAST_FUNC update_utmp(pid_t pid, int new_type, const char *tty_name, const char *username, const
char *hostname)
 {
-	struct utmp utent;
-	struct utmp *utp;
+	struct utmpx utent;
+	struct utmpx *utp;

-	touch(_PATH_UTMP);
-	//utmpname(_PATH_UTMP);
-	setutent();
+	touch(_PATH_UTMPX);
+	//utmpxname(_PATH_UTMPX);
+	setutxent();

 	/* Did init/getty/telnetd/sshd/... create an entry for us?
 	 * It should be (new_type-1), but we'd also reuse
 	 * any other potentially stale xxx_PROCESS entry */
-	while ((utp = getutent()) != NULL) {
+	while ((utp = getutxent()) != NULL) {
 		if (utp->ut_pid == pid
 		// && ut->ut_line[0]
 		 && utp->ut_id[0] /* must have nonzero id */
 <at>  <at>  -88,25 +88,25  <at>  <at>  void FAST_FUNC update_utmp(pid_t pid, int new_type, const char *tty_name, const
 				/* Stale record. Nuke hostname */
 				memset(utp->ut_host, 0, sizeof(utp->ut_host));
 			}
-			/* NB: pututline (see later) searches for matching utent
-			 * using getutid(utent) - we must not change ut_id
+			/* NB: pututxline (see later) searches for matching utxent
+			 * using getutxid(utent) - we must not change ut_id
 			 * if we want *exactly this* record to be overwritten!
 			 */
 			break;
 		}
 	}
-	//endutent(); - no need, pututline can deal with (and actually likes)
+	//endutxent(); - no need, pututxline can deal with (and actually likes)
 	//the situation when utmp file is positioned on found record

 	if (!utp) {
 		if (new_type != DEAD_PROCESS)
 			write_new_utmp(pid, new_type, tty_name, username, hostname);
 		else
-			endutent();
+			endutxent();
 		return;
 	}

-	/* Make a copy. We can't use *utp, pututline's internal getutid
+	/* Make a copy. We can't use *utp, pututxline's internal getutxid
 	 * will overwrite it before it is used! */
 	utent = *utp;

 <at>  <at>  -120,14 +120,14  <at>  <at>  void FAST_FUNC update_utmp(pid_t pid, int new_type, const char *tty_name, const
 	utent.ut_tv.tv_sec = time(NULL);

 	/* Update, or append new one */
-	//setutent();
-	pututline(&utent);
-	endutent();
+	//setutxent();
+	pututxline(&utent);
+	endutxent();

 #if ENABLE_FEATURE_WTMP
 	/* "man utmp" says wtmp file should *not* be created automagically */
 	/*touch(bb_path_wtmp_file);*/
-	updwtmp(bb_path_wtmp_file, &utent);
+	updwtmpx(bb_path_wtmp_file, &utent);
 #endif
 }

diff --git a/miscutils/last.c b/miscutils/last.c
index a144c7e..6d8b584 100644
--- a/miscutils/last.c
+++ b/miscutils/last.c
 <at>  <at>  -32,21 +32,21  <at>  <at> 

 #if defined UT_LINESIZE \
 	&& ((UT_LINESIZE != 32) || (UT_NAMESIZE != 32) || (UT_HOSTSIZE != 256))
-#error struct utmp member char[] size(s) have changed!
+#error struct utmpx member char[] size(s) have changed!
 #elif defined __UT_LINESIZE \
 	&& ((__UT_LINESIZE != 32) || (__UT_NAMESIZE != 64) || (__UT_HOSTSIZE != 256))
-#error struct utmp member char[] size(s) have changed!
+#error struct utmpx member char[] size(s) have changed!
 #endif

 #if EMPTY != 0 || RUN_LVL != 1 || BOOT_TIME != 2 || NEW_TIME != 3 || \
 	OLD_TIME != 4
-#error Values for the ut_type field of struct utmp changed
+#error Values for the ut_type field of struct utmpx changed
 #endif

 int last_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int last_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
 {
-	struct utmp ut;
+	struct utmpx ut;
 	int n, file = STDIN_FILENO;
 	time_t t_tmp;
 	off_t pos;
diff --git a/miscutils/last_fancy.c b/miscutils/last_fancy.c
index 16ed9e9..5e60049 100644
--- a/miscutils/last_fancy.c
+++ b/miscutils/last_fancy.c
 <at>  <at>  -22,6 +22,10  <at>  <at> 
 #define HEADER_LINE_WIDE  "USER", "TTY", \
 	INET6_ADDRSTRLEN, INET6_ADDRSTRLEN, "HOST", "LOGIN", "  TIME", ""

+#if !defined __UT_LINESIZE && defined UT_LINESIZE
+# define __UT_LINESIZE __UT_LINESIZE
+#endif
+
 enum {
 	NORMAL,
 	LOGGED,
 <at>  <at>  -39,7 +43,7  <at>  <at>  enum {

 #define show_wide (option_mask32 & LAST_OPT_W)

-static void show_entry(struct utmp *ut, int state, time_t dur_secs)
+static void show_entry(struct utmpx *ut, int state, time_t dur_secs)
 {
 	unsigned days, hours, mins;
 	char duration[sizeof("(%u+02:02)") + sizeof(int)*3];
 <at>  <at>  -104,7 +108,7  <at>  <at>  static void show_entry(struct utmp *ut, int state, time_t dur_secs)
 		duration_str);
 }

-static int get_ut_type(struct utmp *ut)
+static int get_ut_type(struct utmpx *ut)
 {
 	if (ut->ut_line[0] == '~') {
 		if (strcmp(ut->ut_user, "shutdown") == 0) {
 <at>  <at>  -142,7 +146,7  <at>  <at>  static int get_ut_type(struct utmp *ut)
 	return ut->ut_type;
 }

-static int is_runlevel_shutdown(struct utmp *ut)
+static int is_runlevel_shutdown(struct utmpx *ut)
 {
 	if (((ut->ut_pid & 255) == '0') || ((ut->ut_pid & 255) == '6')) {
 		return 1;
 <at>  <at>  -154,7 +158,7  <at>  <at>  static int is_runlevel_shutdown(struct utmp *ut)
 int last_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int last_main(int argc UNUSED_PARAM, char **argv)
 {
-	struct utmp ut;
+	struct utmpx ut;
 	const char *filename = _PATH_WTMP;
 	llist_t *zlist;
 	off_t pos;
 <at>  <at>  -242,9 +246,9  <at>  <at>  int last_main(int argc UNUSED_PARAM, char **argv)
 			{
 				llist_t *el, *next;
 				for (el = zlist; el; el = next) {
-					struct utmp *up = (struct utmp *)el->data;
+					struct utmpx *up = (struct utmpx *)el->data;
 					next = el->link;
-					if (strncmp(up->ut_line, ut.ut_line, UT_LINESIZE) == 0) {
+					if (strncmp(up->ut_line, ut.ut_line, __UT_LINESIZE) == 0) {
 						if (show) {
 							show_entry(&ut, NORMAL, up->ut_tv.tv_sec);
 							show = 0;
diff --git a/miscutils/runlevel.c b/miscutils/runlevel.c
index 76231df..8558db8 100644
--- a/miscutils/runlevel.c
+++ b/miscutils/runlevel.c
 <at>  <at>  -29,19 +29,19  <at>  <at> 
 int runlevel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int runlevel_main(int argc UNUSED_PARAM, char **argv)
 {
-	struct utmp *ut;
+	struct utmpx *ut;
 	char prev;

-	if (argv[1]) utmpname(argv[1]);
+	if (argv[1]) utmpxname(argv[1]);

-	setutent();
-	while ((ut = getutent()) != NULL) {
+	setutxent();
+	while ((ut = getutxent()) != NULL) {
 		if (ut->ut_type == RUN_LVL) {
 			prev = ut->ut_pid / 256;
 			if (prev == 0) prev = 'N';
 			printf("%c %c\n", prev, ut->ut_pid % 256);
 			if (ENABLE_FEATURE_CLEAN_UP)
-				endutent();
+				endutxent();
 			return 0;
 		}
 	}
 <at>  <at>  -49,6 +49,6  <at>  <at>  int runlevel_main(int argc UNUSED_PARAM, char **argv)
 	puts("unknown");

 	if (ENABLE_FEATURE_CLEAN_UP)
-		endutent();
+		endutxent();
 	return 1;
 }
diff --git a/miscutils/wall.c b/miscutils/wall.c
index bb709ee..50658f4 100644
--- a/miscutils/wall.c
+++ b/miscutils/wall.c
 <at>  <at>  -32,7 +32,7  <at>  <at> 
 int wall_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int wall_main(int argc UNUSED_PARAM, char **argv)
 {
-	struct utmp *ut;
+	struct utmpx *ut;
 	char *msg;
 	int fd;

 <at>  <at>  -46,8 +46,8  <at>  <at>  int wall_main(int argc UNUSED_PARAM, char **argv)
 	msg = xmalloc_read(fd, NULL);
 	if (ENABLE_FEATURE_CLEAN_UP && argv[1])
 		close(fd);
-	setutent();
-	while ((ut = getutent()) != NULL) {
+	setutxent();
+	while ((ut = getutxent()) != NULL) {
 		char *line;
 		if (ut->ut_type != USER_PROCESS)
 			continue;
 <at>  <at>  -56,7 +56,7  <at>  <at>  int wall_main(int argc UNUSED_PARAM, char **argv)
 		free(line);
 	}
 	if (ENABLE_FEATURE_CLEAN_UP) {
-		endutent();
+		endutxent();
 		free(msg);
 	}
 	return EXIT_SUCCESS;
diff --git a/procps/uptime.c b/procps/uptime.c
index 778812a..149bae6 100644
--- a/procps/uptime.c
+++ b/procps/uptime.c
 <at>  <at>  -81,10 +81,10  <at>  <at>  int uptime_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)

 #if ENABLE_FEATURE_UPTIME_UTMP_SUPPORT
 	{
-		struct utmp *ut;
+		struct utmpx *ut;
 		unsigned users = 0;
-		while ((ut = getutent()) != NULL) {
-			if ((ut->ut_type == USER_PROCESS) && (ut->ut_name[0] != '\0'))
+		while ((ut = getutxent()) != NULL) {
+			if ((ut->ut_type == USER_PROCESS) && (ut->ut_user[0] != '\0'))
 				users++;
 		}
 		printf(",  %u users", users);
--

-- 
2.1.4
Alexis Guilloteau | 26 Mar 11:34 2015
Picon

Connect to telnet with another user

Hi,

When trying to connect to the telnet daemon a user and password is asked and it seems only root superuser is accepted.

My passwd file is like this :
root::0:0:root:/:/bin/sh
telnet:telnet:3:0:telnet:/:/bin/sh
ftp:ftp:4:0:ftp:/:/bin/sh
bin:*:1:1:bin:/bin:
daemon:*:2:2:daemon:/sbin:
nobody:*:99:99:Nobody:/:

my shadow is empty

my group is :
root:*:0:
daemon:*:1:
bin:*:2:
sys:*:3:
adm:*:4:
tty:*:5:
disk:*:6:
lp:*:7:lp
mail:*:8:
news:*:9:
uucp:*:10:
proxy:*:13:
kmem:*:15:
dialout:*:20:
fax:*:21:
voice:*:22:
cdrom:*:24:
floppy:*:25:
tape:*:26:
sudo:*:27:
audio:*:29:
ppp:x:99:

When trying with the user "telnet" and writting "telnet" as password i have a "Login incorrect" message.
It must surely be something small but i can't fin it.
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Alexis Guilloteau | 26 Mar 09:49 2015
Picon

FTPD suddenly ask for a user and password after working anonymously for days

Hi,

Last week i was running the ftp deamon from busybox and was stuck because it only was an anonymous connection (and i wanted an user/password). Up to last week end it was liek this.
Today i wanted to work on it, i launched firefox, type ftp://10.2.29.220/ to connect to the ftp eamon and a user/password interface opened ! (with no change from me in anything) I have the message :

FTP not authorized

The FTP server at 10.2.29.220 responded to the PASS command with
530 Login failed.
Typically this means the server does not accept anonymous FTP access and you provided no login credentials, or the credentials you provided were invalid. Note if your browser is Internet Explorer versions 7 or 8, you must provide FTP login credentials in the URL request line, because IE does not provide a popup login window for FTP-over-HTTP transactions. For IE users, access the requested site using this format
ftp://user:password <at> ftp.example.com
Be aware that credentials transmitted over FTP or plaintext HTTP are visible in the clear

In my understanding this mean the ftp eamon is running (or i would not have this message) but why is it now asking a user and passwor when i read time and time here that it was anonymous only ?
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Martin dørum nygaard | 26 Mar 02:03 2015
Picon

Typo in the source code; "refcount" written as "refocunt".

Hey. I just noticed a typo in e2fsck.c, where ext2fs_adjust_ea_refcount has been typo'd to ext2fs_adjust_ea_refocunt in an error message: 

http://sources.debian.net/src/busybox/1:1.22.0-9/e2fsprogs/old_e2fsprogs/e2fsck.c/?hl=11465#L11465

I'm not sure if this is important, especially considering it's in a dir called old_e2fsprogs, which indicates that it may not be used anymore, but I figured I'd tell you anyways.
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Denys Vlasenko | 22 Mar 18:10 2015

Re: [PATCH] zcip: fix link-local IP conflict detection

Fix applied.
Sorry!

On Thu, Mar 19, 2015 at 3:51 PM, Ken Sharp <ken.sharp <at> ni.com> wrote:
> Hi Vladislav,
>
> It appears that my original patch was (legitimately) refactored and the
> inversion in logic was introduced.  Good catch!
>
> Regards,
> Ken Sharp
>
>
>
> From:   "Vladislav Grishenko" <themiron <at> mail.ru>
> To:     "'Denys Vlasenko'" <vda.linux <at> googlemail.com>, "'Ben Shelton'"
> <ben.shelton <at> ni.com>,
> Cc:     "'busybox'" <busybox <at> busybox.net>, "'Ken Sharp'"
> <ken.sharp <at> ni.com>
> Date:   03/19/2015 06:30 AM
> Subject:        RE: [PATCH] zcip: fix link-local IP conflict detection
>
>
>
> Hi Denys,
>
> Applied commit "a4d564ad zcip: fix link-local IP conflict detection" has
> introduced wrong
> comparison of source IP with our/choosen IP. This again leads to a new IP
> being repacked
> on every incoming ARP packet.
> Please refer patch against current git attached.
>
> Best Regards, Vladislav Grishenko
>
>> -----Original Message-----
>> From: busybox-bounces <at> busybox.net [mailto:busybox-
>> bounces <at> busybox.net] On Behalf Of Denys Vlasenko
>> Sent: Sunday, July 20, 2014 6:03 PM
>> To: Ben Shelton
>> Cc: busybox; Ken Sharp
>> Subject: Re: [PATCH] zcip: fix link-local IP conflict detection
>>
>> On Thu, Jul 17, 2014 at 6:34 PM, Ben Shelton <ben.shelton <at> ni.com> wrote:
>> > From: Ken Sharp <ken.sharp <at> ni.com>
>> >
>> > During link-local IP resolution, if a regular ARP request is received
>> > during the ARP probe period, it will incorrectly cause a target IP
>> > conflict.  This then leads to a new IP being picked unnecessarily.
>> >
>> > Per RFC 3927, section 2.2.1, we should flag a target IP conflict only
>> > if the source IP is null, the target IP matches our IP, and the source
>> > hw addr does not match our hw addr.
>> >
>> > Signed-off-by: Ken Sharp <ken.sharp <at> ni.com>
>> > Signed-off-by: Ben Shelton <ben.shelton <at> ni.com>
>> > ---
>> >
>> > Note that we reproduced the issue and tested the fix on an ARM
>> > A9-based board as follows:
>> >
>> > - Connect two machines via a crossover cable or on a network with no
>> DHCP
>> >   server available.
>> > - Continuously ping the machine running busybox from the other
>> > - Reboot the busybox machine (the one being pinged)
>> > - When the busybox machine comes back up it will have a different IP
>> >   address because of the incorrect target IP conflict
>> >
>>
>>
>> Applied, thanks!
>> _______________________________________________
>> busybox mailing list
>> busybox <at> busybox.net
>> http://lists.busybox.net/mailman/listinfo/busybox
> [attachment
> "0001-zcip-fix-wrong-comparison-of-source-IP-with-our-IP.patch" deleted by
> Ken Sharp/AUS/NIC]
>
Harald Becker | 20 Mar 15:03 2015
Picon
Picon

RFD: One-shot table driven system setup

Hi !

*Intention:*

My original intention was (beside geting netlink operation), to add some 
extensions to mdev, to have the ability to do a simple table driven 
one-shot startup of the device file system.

The same extensions would also allow to bring up the other virtual file 
systems, at no extra cost, but let Laurent correctly state, that this 
would mix functionality into mdev, logically not belonging to the device 
file system.

So the decision was to split the intended initial function (xdev -i) and 
build the table driven startup feature into it's own applet (confsh), 
independed from any used device file system management.

This also allows to extend the intended functionality, without mixing 
logical functionality, bringing this to a hopefully general purpose 
method for easy table driven setup operations.

*Primary goal:*

The primary idea of confsh is simplification of the system setup, not 
replacing one type of complexity with a different one. Where the novice 
admin shall get the possibility to setup a simple system in an easy 
manner, and the expert shall gain from simplicity for the default things 
done a thousand times, but still have the ability to insert hookups 
(call helper scripts) to do any special kind of operation he likes to do.

For this approach the focus lies on description on what is required, has 
to be done or setup in *your* system (table of descriptive lines), 
instead of the usual shell script approach, describing more how this 
operation is done (all the commands to achieve the result).

Anyway shall confsh *not break* the KISS principal, Busybox is 
following, *not wasting* resources otherwise useless, and *not build* 
any specific system setup operation into the binary code.

*Planned operation:

The planned operation is a shell pre-processor, which read a specified 
configuration file for a table driven system setup operation, create a 
shell script and pass (pipe) that to /bin/sh (or may be better $SHELL 
with default /bin/busybox ash ?). This approach allow table driven 
operation for general kinds of environmental setups, either system or 
application related.

The lead in code send to the shell, instructs that to read a 
configurable script file (setup by system maintainer, example provided 
in distribution), defining the required shell functions for the 
operation of confsh. The generated script code will never do any 
specific system operation, but pre-parse and check the conf file format, 
then create shell friendly function calls with a constant order of 
arguments.

e.g. generating shell script code for a mount line from table format
(the brackets mean optional):

MOUNTPOINT [OWNER[:GROUP] [MODE]]  <at>  FSTYPE[:DEVICE] [OPTION] [#PASS]

=> create this shell script line (passed to shell via pipe):

cf_mount MOUNTPOINT OWNER GROUP MODE FSTYPE DEVICE OPTION [PASS]

where cf_mount() is defined in confsh-script.sh:

# cf_mount - create mount point and mount given file system
#   $1 = MOUNTPOINT
#   $2 = OWNER or ''
#   $3 = GROUP or ''
#   $4 = MODE or ''
#   $5 = FSTYPE
#   $6 = DEVICE or ''
#   $7 = OPTIONS or ''
#   $8 = fsck PASS number or absent
#   (giving a pass number include this entry in a created fstab)
cf_mount()
{
   ... do all required operation to create the mount point
   ... set owner, group, mode, and mount the file system
   if [ -n "$8" ]
     then ... add a line to variable CF_TABLE_FSTAB
   fi
}

*More complete example:*

/etc/devfs-setup.conf:
(this what the system maintainer write)

---cut-here---
#!/bin/busybox confsh
# (confsh may be used as script interpreter)
# (or called: /bin/busybox confsh CONF_FILE_NAME [ARGS])

# ... here may go other setup stuff

# setup the initial device file system:

# (create empty mount point with owner, group, mode)
# (explicit creation of mount points allow to setup any permission)
/dev  root:hotplug  0751  <at> 

# (mount the file system with the given options)
# (if mount point does not exit, try auto create with root:root 0751)
/dev  root:root  0755   <at>   tmpfs relatime,size=10240k

# (create empty mount points in the device file system)
/dev/pts     root:root  0751  <at> 
/dev/shm     root:root  0751  <at> 
/dev/mqueue  root:root  0751  <at> 

# (mount the virtual file systems in /dev)
/dev/pts     root:root    0755   <at>   devpts  #0
/dev/shm     root:root    1777   <at>   tmpfs   #0
/dev/mqueue  root:mqueue  1777   <at>   mqueue  #0

# create devfstab table
write fstab /var/run/config.d/devfstab root:admins 0644

# ... more stuff to setup
---cut-here---

=> shall create a shell script to invoke the desired operations, which 
also write the file /var/run/config.d/devfstab (with perm root:admins, 
mode 0644):

(this file is create due to write fstab command):

---cut-here---
# *** auto generated file, don't edit, for changes see ... ***
virtual /dev/pts devpts defaults 0 0
virtual /dev/shm tmpfs defaults 0 0
virtual /dev/mqueue mqueue defaults 0 0
---cut-here---

Note: The /dev virtual file system is not included in the devfstab file, 
as this mount line is not given with a fsck pass number at the end of 
the line (intentional as an example).

Rough approximation of script passed to the shell (details are a bit 
finer, and without the comments):

(this is created by the operation of confsh binary):

---cut-here---
# load the cf_* shell functions
. confsh-script 'CONF_FILE_NAME'
while :
  do
   ...

   # the /dev file system
   cf_mountpoint /dev root hotplug 0751
   cf_mount /dev root root 0755 tmpfs 'relatime,size=10240k'

   # other file systems in /dev
   cf_mountpoint /dev/pts root root 0751
   cf_mountpoint /dev/shm root root 0751
   cf_mountpoint /dev/mqueue root root 0751
   cf_mount /dev/pts root root 0755 devpts '' 0
   cf_mount /dev/shm root root 1777 tmpfs '' 0
   cf_mount /dev/mqueue root mqueue 1777 mqueue '' 0

   # write the devfstab file
   cf_write fstab /var/run/config.d/devfstab root admins 0644

   ...
   exit 0
  done
---cut-here---

*Attention:*

The intended operation, and details, are nevertheless complete. I'm 
currently working on a proposal of the conf file format, trying to find 
an intuitive syntax, but at least easily readable, still giving the 
ability to configure and trigger invocation of most of the usual system 
setup operation. Where my start point for the syntax the base format of 
mdev.conf is. Suggestions for possible setup operations and the intended 
syntax, are highly appreciated.

*Functionality:*

The following functionalities for table driven setups are intended (List 
and details as base for discussion):

- allow including of other conf files or all files from a directory

- emit messages on stderr
   (usually the console)

- file operations
   (touch, permissions, move, copy, remove)

- directory operations
   (create, permissions, move, copy, remove)

- symlink operations
   (create, remove)

- mount point operations
   (create, permissions, unmount, remove)
   (I like to auto create an empty file of name "not mounted" with mode
    0000 in empty mount point directories, as a novice human visible
    indicator; this is pure preference, but all such things can be done
    by logically separating mount points from other directories)

- mount operations
   (auto create, mount, permissions, fstab creation)

- easily setting sysctl values
   (write value to /proc/sys/...)

- loading a keyboard table

- loading the console font

- auto creating or replacing configuration files
   (fstab, mdev.conf, ...)
   (what seams to be interesting to be setup from central place?)

- wait for accessibility of a specific device / file
   (wait until device / file exist and is readable)
   (with a possible timeout)

   can be checked with (?):
     [ -r DEVICE ] && dd if=DEVICE of=/dev/null bs=1 count=1 2>/dev/null

- wait for accessibility of a specific file system (LABEL/UUID)
   (use blkid to get device for LABEL/UU1D, then wait for device)

- loading kernel modules
   (invoke modprobe with given module names)
   (this not for module hotplug, but for manual module loading)

- removing kernel modules
   (trigger removing of specified modules)

- invoke (source) other shell scripts with arguments
   (for the more novice usage of functional extension)

- embed any snippet of shell commands into output piped to shell
   (for the experts usage)
   (the shell snippet shall go inside a sub shell '('...')')

*This list is not complete*, let me know what you are missing!

*Please* keep in mind: My intention is to create a shell pre-processor 
and a shell script with default implementation of such operations, not 
to reinvent or creation of a new shell, or to implement all such 
operation details in binary code. Only the table parser, format checks, 
slight sanity checks, and creation of a minimum for shell function 
invocation is to be done in the binary code. The remaining operations 
are controlled by the called shell functions (example implementation 
will be provided, but may be modified to your likeness).

Anyway: Using the preprocessor approach allow to benefit from shell 
substitutions and expansions ($ENVVAR, etc.), without reinventing such 
things.

(Thanks to Isaac and Laurent, for pre-release suggestions to this.)

--
Harald

Tar/gzip Commands: Busybox vs. GNU (error: Invalid magic)

Hi,

 

I am working on an embedded OS called YOCTO, which apparently includes BusyBox into its build. YOCTO is currently running on a target board, and I am trying to integrate an AMD Radeon E8860 GPU into it. This requires installation of a driver called “fglrx”, otherwise also known as AMD Catalyst. The driver installer (which is a .run) uses BusyBox “gzip –cd” and “tar” commands to extract an undisclosed internal file, which returned the error message “Invalid magic.” This does not happen when I try running the driver installer on a desktop UBUNTU OS, which uses GNU. I was wondering what the key differences between GNU’s and Busybox’s extraction functions were, and what I could do to fix this error.

 

Thanks,

Simon Chen

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

Gmane