Mahavir Jain | 1 Jan 2009 08:57
Picon

udhcpd server lease expiration issue

Hi,

I was working with busybox 1.12.0 . I found that dhcp server never
shows amount time remaining in lease to expire with,

$ dumpleases -f /var/lib/udhcpd.lease

It just shows amount of lease allocated. I also tried -r option but it
didn't work either. Please let me know whether it's issue or something
wrong with my settings....?   Because we should know when lease is
expired for specific client...
Denys Vlasenko | 1 Jan 2009 18:53

Re: udhcpd server lease expiration issue

On Thursday 01 January 2009 08:57, Mahavir Jain wrote:
> Hi,
> 
> I was working with busybox 1.12.0 . I found that dhcp server never
> shows amount time remaining in lease to expire with,
> 
> $ dumpleases -f /var/lib/udhcpd.lease
> 
> It just shows amount of lease allocated.

You need to set auto_time in udhcpd config file to something
smaller than default 7200 seconds (2 hours) in order to make udhcpd
write out lease file more often. Or "killall -USR1 udhcpd"
to force it to do that.

Unfortunately current leasefile format is stupid, it does not
allow to figure out how old (stale) is it, and lease times
are encoded as offsets from "current time" (which is not in the file!)
Thus, "watch dumpleases -f /var/lib/udhcpd.lease" will never
show you how lease times tick down to zero,
they will be unchanged until udhcpd rewrites the file.

> I also tried -r option but it 
> didn't work either.

-r option is the default, it won't change anything. -a option
is supposed to show "absolute" expiration time, but is broken.
Add these lines in networking/udhcp/dumpleases.c:

               } else /* -a */
(Continue reading)

Walter Harms | 1 Jan 2009 22:55
Picon
Favicon

rework: login.c

hi list,
i did some rework of the 13.0 login code and fixed some border cases.
mostly code cleanup to improve readability.
the important step is that getpwnam_r now uses
sysconf(_SC_GETPW_R_SIZE_MAX) to allocate enough space. My version of
glibc reports 1024 that is much more that the current limit of 256. maybe
that should be changed.

denys,
i made a lot of small changes please check if want to copy some changes
into the current code.

here is the PAM case

Final link with: pam_misc
function                                             old     new   delta
check_pswd                                             -     447    +447
run_login_script                                       -     209    +209
my_getpwnam_r                                          -     100    +100
login_main                                          1851    1043    -808
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 0/1 up/down: 756/-808)          Total: -52
bytes
   text    data     bss     dec     hex filename
  30238     685    8284   39207    9927 busybox_old
  30240     689    8284   39213    992d busybox_unstripped
Attachment (login.c): text/x-csrc, 15 KiB
_______________________________________________
(Continue reading)

Mahavir Jain | 2 Jan 2009 05:29
Picon

Re: udhcpd server lease expiration issue

Hi,

Thanks for making sure that i am not wrong.(Reply)

This is my udhcpd.conf file,

start 192.168.1.100
end 192.168.1.200
interface br0
opt      lease  86400
opt     router  192.168.1.1
opt     subnet  255.255.255.0
opt     dns     192.168.1.1
opt     domain     localdomain
max_leases     101
lease_file     /var/lib/udhcpd.leases

In busybox 1.5.0 , i was able to fix it as

 printf(" %-15s ", inet_ntoa(addr));
 expires = ntohl(lease.expires);
 +  expires -= time(0);

 if (mode == REMAINING) {
                        if (!expires)
                                printf("expired\n");

Adding same thing to get amount of time remaining in busybox 1.12.0
gives me some decrementing count in

(Continue reading)

Denys Vlasenko | 3 Jan 2009 16:13

Re: udhcpd server lease expiration issue

On Friday 02 January 2009 05:29, Mahavir Jain wrote:
> Hi,
> 
> Thanks for making sure that i am not wrong.(Reply)
> 
> This is my udhcpd.conf file,
> 
> start 192.168.1.100
> end 192.168.1.200
> interface br0
> opt      lease  86400
> opt     router  192.168.1.1
> opt     subnet  255.255.255.0
> opt     dns     192.168.1.1
> opt     domain     localdomain
> max_leases     101
> lease_file     /var/lib/udhcpd.leases

auto_time is not set, thus udhcpd uses default value of 7200 seconds.

> In busybox 1.5.0 , i was able to fix it as
> 
>  printf(" %-15s ", inet_ntoa(addr));
>  expires = ntohl(lease.expires);
>  +  expires -= time(0);

What do you plan to achieve by doing it?

>  if (mode == REMAINING) {
>                         if (!expires)
(Continue reading)

Timo Teräs | 3 Jan 2009 16:36
Picon
Picon
Favicon

[patch] depmod -b

Hi,

I somehow missed that the depmod -b option does not do at all what it is supposed
to do. It just did a chdir() to the basedir which is wrong. Not sure why it was
done like that.

The module-init-tools manpage explains:

-b basedir --basedir basedir
   If  your  modules  are  not  currently  in  the (normal) directory /lib/mod-
   ules/version, but in a staging area, you can  specify  a  basedir  which  is
   prepended  to the directory name.  This basedir is stripped from the result-
   ing modules.dep file, so it is ready to be moved into the normal location.

So the basedir is prepended when *looking* for the files, but it's not included
in the output dependency file.

Attached is a patch to fix it. The patch also fixes the freopen() not
complaining on error.

It's +163 bytes here. But absolutely necessary to make the -b useful at all.

- Timo
Attachment (depmod.diff): text/x-diff, 3737 bytes
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
(Continue reading)

Rob Landley | 3 Jan 2009 22:32

The busybox "printf" command is always 32 bit even when the shell isn't.

$ printf %x 2251797561885434; echo
7ffff79c842fa
$ ./busybox printf %x 2251797561885434; echo
79c842fa

I need 64 bit math to convert timeconst.pl to timeconst.sh in the Linux kernel 
build...

Rob
Denys Vlasenko | 4 Jan 2009 03:40

Re: The busybox "printf" command is always 32 bit even when the shell isn't.

On Saturday 03 January 2009 22:32, Rob Landley wrote:
> $ printf %x 2251797561885434; echo
> 7ffff79c842fa
> $ ./busybox printf %x 2251797561885434; echo
> 79c842fa
> 
> I need 64 bit math to convert timeconst.pl to timeconst.sh in the Linux kernel 
> build...

By your command

--
vda
Attachment (1.patch): text/x-diff, 6102 bytes
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Rob Landley | 4 Jan 2009 05:27

Re: The busybox "printf" command is always 32 bit even when the shell isn't.

On Saturday 03 January 2009 20:40:48 Denys Vlasenko wrote:
> On Saturday 03 January 2009 22:32, Rob Landley wrote:
> > $ printf %x 2251797561885434; echo
> > 7ffff79c842fa
> > $ ./busybox printf %x 2251797561885434; echo
> > 79c842fa
> >
> > I need 64 bit math to convert timeconst.pl to timeconst.sh in the Linux
> > kernel build...
>
> By your command

Thanks, and I'm happy to have this patch now to help get the perl removal 
stuff into the kernel, but going forward I think there should probably be a 
big config switch, "use 64 bit math on 32 bit platforms".

Generally if you want 64 bit math, you probably want it everywhere, but 32 bit 
systems will be with us in the embedded world for a while yet (especially arm 
and mips and such), and doing unnecessary 64 bit math there is especially 
painful.

Also, what's the deal with ash "built in printf"?  Does this relate to nofork, 
or is it a separate implementation, or...?

Thanks,

Rob
Denys Vlasenko | 4 Jan 2009 17:05

Re: The busybox "printf" command is always 32 bit even when the shell isn't.

On Sunday 04 January 2009 05:27, Rob Landley wrote:
> On Saturday 03 January 2009 20:40:48 Denys Vlasenko wrote:
> > On Saturday 03 January 2009 22:32, Rob Landley wrote:
> > > $ printf %x 2251797561885434; echo
> > > 7ffff79c842fa
> > > $ ./busybox printf %x 2251797561885434; echo
> > > 79c842fa
> > >
> > > I need 64 bit math to convert timeconst.pl to timeconst.sh in the Linux
> > > kernel build...
> >
> > By your command
> 
> Thanks, and I'm happy to have this patch now to help get the perl removal 
> stuff into the kernel, but going forward I think there should probably be a 
> big config switch, "use 64 bit math on 32 bit platforms".
> 
> Generally if you want 64 bit math, you probably want it everywhere, but 32 bit 
> systems will be with us in the embedded world for a while yet (especially arm 
> and mips and such), and doing unnecessary 64 bit math there is especially 
> painful.
> 
> Also, what's the deal with ash "built in printf"?  Does this relate to nofork, 
> or is it a separate implementation, or...?

Shells have "builtins". Which are sort of NOFORK, but are enabled
independently of NOFORK. The rationale is that even if you do not
use NOEXEC and NOFORK _applets_ (which is understandable,
they are not as stable as I would like),
you sure want "echo", "test" etc in shells to not be slow as hell.
(Continue reading)


Gmane