diff mbox

[U-Boot,PATCHv2] bootp: add ntpserver option to bootp request

Message ID 1305512681-8167-1-git-send-email-judge.packham@gmail.com
State Changes Requested
Headers show

Commit Message

Chris Packham May 16, 2011, 2:24 a.m. UTC
From: Luuk Paulussen <luuk.paulussen@alliedtelesis.co.nz>

Signed-off-by: Luuk Paulussen <luuk.paulussen@alliedtelesis.co.nz>
Acked-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Cc: Ben Warren <biggerbadderben@gmail.com>
---
Changes since v1:
- fixed compile error in BootpVendorProcess when CONFIG_CMD_SNTP is not
  defined

 net/bootp.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

Comments

Sergei Shtylyov May 16, 2011, 11:57 a.m. UTC | #1
Hello.

On 16-05-2011 6:24, Chris Packham wrote:

> From: Luuk Paulussen <luuk.paulussen@alliedtelesis.co.nz>

> Signed-off-by: Luuk Paulussen<luuk.paulussen@alliedtelesis.co.nz>
> Acked-by: Chris Packham<chris.packham@alliedtelesis.co.nz>
> Cc: Ben Warren<biggerbadderben@gmail.com>
[...]

> diff --git a/net/bootp.c b/net/bootp.c
> index 4db63cb..18c743e 100644
> --- a/net/bootp.c
> +++ b/net/bootp.c
> @@ -228,6 +228,11 @@ static void BootpVendorFieldProcess (u8 * ext)
>   			NetOurNISDomain[size] = 0;
>   		}
>   		break;
> +#if defined(CONFIG_CMD_SNTP)&&  defined(CONFIG_BOOTP_NTPSERVER)
> +	case 42:	/* NTP server IP */
> +		NetCopyIP (&NetNtpServerIP, (IPaddr_t *) (ext + 2));

    There should be no space between function name and (. You're now supposed 
to run your patch thru scripts/checkpatch.pl (from Linux source tree).

> +		break;
> +#endif
>   		/* Application layer fields */
>   	case 43:		/* Vendor specific info - Not yet supported	*/
>   		/*
> @@ -538,6 +548,11 @@ static int BootpExtended (u8 * e)
>   	*e++ = 32;
>   	e   += 32;
>   #endif
> +#if defined(CONFIG_BOOTP_NTPSERVER)
> +	*e++  = 42;

    Too many spaces...

> +	*e++ = 4;
> +	e   += 4;
> +#endif

WBR, Sergei
Chris Packham May 17, 2011, 4:09 a.m. UTC | #2
Hi Sergei,

On Mon, May 16, 2011 at 11:57 PM, Sergei Shtylyov <sshtylyov@mvista.com> wrote:
> Hello.
>
> On 16-05-2011 6:24, Chris Packham wrote:
>
>> From: Luuk Paulussen <luuk.paulussen@alliedtelesis.co.nz>
>
>> Signed-off-by: Luuk Paulussen<luuk.paulussen@alliedtelesis.co.nz>
>> Acked-by: Chris Packham<chris.packham@alliedtelesis.co.nz>
>> Cc: Ben Warren<biggerbadderben@gmail.com>
>
> [...]
>
>> diff --git a/net/bootp.c b/net/bootp.c
>> index 4db63cb..18c743e 100644
>> --- a/net/bootp.c
>> +++ b/net/bootp.c
>> @@ -228,6 +228,11 @@ static void BootpVendorFieldProcess (u8 * ext)
>>                        NetOurNISDomain[size] = 0;
>>                }
>>                break;
>> +#if defined(CONFIG_CMD_SNTP)&&  defined(CONFIG_BOOTP_NTPSERVER)
>> +       case 42:        /* NTP server IP */
>> +               NetCopyIP (&NetNtpServerIP, (IPaddr_t *) (ext + 2));
>
>   There should be no space between function name and (. You're now supposed
> to run your patch thru scripts/checkpatch.pl (from Linux source tree).

Will fix (and run through checkpatch.pl) in next version.

>> +               break;
>> +#endif
>>                /* Application layer fields */
>>        case 43:                /* Vendor specific info - Not yet supported
>>     */
>>                /*
>> @@ -538,6 +548,11 @@ static int BootpExtended (u8 * e)
>>        *e++ = 32;
>>        e   += 32;
>>  #endif
>> +#if defined(CONFIG_BOOTP_NTPSERVER)
>> +       *e++  = 42;
>
>   Too many spaces...

Ditto.

>> +       *e++ = 4;
>> +       e   += 4;
>> +#endif
>
> WBR, Sergei
>

v3 coming shortly
diff mbox

Patch

diff --git a/net/bootp.c b/net/bootp.c
index 4db63cb..18c743e 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -228,6 +228,11 @@  static void BootpVendorFieldProcess (u8 * ext)
 			NetOurNISDomain[size] = 0;
 		}
 		break;
+#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
+	case 42:	/* NTP server IP */
+		NetCopyIP (&NetNtpServerIP, (IPaddr_t *) (ext + 2));
+		break;
+#endif
 		/* Application layer fields */
 	case 43:		/* Vendor specific info - Not yet supported	*/
 		/*
@@ -278,6 +283,11 @@  static void BootpVendorProcess (u8 * ext, int size)
 
 	if (NetBootFileSize)
 		debug("NetBootFileSize: %d\n", NetBootFileSize);
+
+#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
+	if (NetNtpServerIP)
+		debug("NetNtpServerIP : %pI4\n", &NetNtpServerIP);
+#endif
 }
 /*
  *	Handle a BOOTP received packet.
@@ -538,6 +548,11 @@  static int BootpExtended (u8 * e)
 	*e++ = 32;
 	e   += 32;
 #endif
+#if defined(CONFIG_BOOTP_NTPSERVER)
+	*e++  = 42;
+	*e++ = 4;
+	e   += 4;
+#endif
 
 	*e++ = 255;		/* End of the list */