Ah... ok :-) I thought I had done something wrong without realising it :-)

Sent from my iPhone

> On 13 Nov 2018, at 01:08, Sean MacLennan <se...@seanm.ca> wrote:
> 
> It would really help the world... ok, me... if the script was given the
> reason it was being called. Mainly I want to know if it is a renewal.
> 
> diff --git a/sdhcp.c b/sdhcp.c
> index e2a641e..b6cbfe7 100644
> --- a/sdhcp.c
> +++ b/sdhcp.c
> @@ -322,7 +339,7 @@ dhcprecv(void)
> }
> 
> static void
> -acceptlease(void)
> +acceptlease(const char *reason)
> {
>    char buf[128];
> 
> @@ -341,6 +358,7 @@ acceptlease(void)
>        setenv("ROUTER", buf, 1);
>        snprintf(buf, sizeof(buf), "%d.%d.%d.%d", dns[0], dns[1], dns[2], 
> dns[3]);
>        setenv("DNS", buf, 1);
> +        setenv("REASON", reason, 1);
>        system(program);
>    }
>    alarm(t1);
> @@ -378,7 +396,7 @@ Requesting:
>    case DHCPoffer:
>        goto Requesting; /* ignore other offers. */
>    case DHCPack:
> -        acceptlease();
> +        acceptlease("BOUND");
>        goto Bound;
>    }
> Bound:
> @@ -400,7 +418,7 @@ Bound:
> Renewing:
>    switch(dhcprecv()) {
>    case DHCPack:
> -        acceptlease();
> +        acceptlease("RENEW");
>        goto Bound;
>    case DHCPnak:
>        goto Init;
> @@ -413,7 +431,7 @@ Rebinding:
>    case DHCPnak: /* lease expired */
>        goto Init;
>    case DHCPack:
> -        acceptlease();
> +        acceptlease("REBIND");
>        goto Bound;
>    }
> }
> 

Reply via email to