public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
* [Bug 1001170] New: Correct Endianness of DHCP "Seconds Elapsed" field
@ 2011-03-09 11:45 bugzilla-daemon
  2011-03-09 18:26 ` [Bug 1001170] " bugzilla-daemon
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: bugzilla-daemon @ 2011-03-09 11:45 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001170

           Summary: Correct Endianness of DHCP "Seconds Elapsed" field
           Product: eCos
           Version: unknown
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: low
         Component: Patches and contributions
        AssignedTo: unassigned@bugs.ecos.sourceware.org
        ReportedBy: kelvinl@users.sf.net
                CC: ecos-patches@ecos.sourceware.org
             Class: Advice Request


The bp_secs (Seconds Elapsed) field is not converted to network byte order,
resulting in badly ordered bytes depending on machine endianness.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug 1001170] Correct Endianness of DHCP "Seconds Elapsed" field
  2011-03-09 11:45 [Bug 1001170] New: Correct Endianness of DHCP "Seconds Elapsed" field bugzilla-daemon
@ 2011-03-09 18:26 ` bugzilla-daemon
  2011-03-09 23:59   ` Jay Foster
  2011-03-10  5:38 ` bugzilla-daemon
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 10+ messages in thread
From: bugzilla-daemon @ 2011-03-09 18:26 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001170

--- Comment #1 from Sergei Gavrikov <sergei.gavrikov@gmail.com> 2011-03-09 18:26:22 GMT ---
Created an attachment (id=1167)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=1167)
Fixed byte order for bp_secs

diffstat /tmp/dhcp_prot.diff
 ChangeLog       |    5 +++++
 src/dhcp_prot.c |    2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

Grep shows 1 actual place. Hope that's it.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Bug 1001170] Correct Endianness of DHCP "Seconds Elapsed" field
  2011-03-09 18:26 ` [Bug 1001170] " bugzilla-daemon
@ 2011-03-09 23:59   ` Jay Foster
  0 siblings, 0 replies; 10+ messages in thread
From: Jay Foster @ 2011-03-09 23:59 UTC (permalink / raw)
  To: bugzilla-daemon; +Cc: ecos-patches

It also appears in bootp_support.c: show_bootp().

Depending on the implementation of htons(), cyg_current_time() may end 
up getting called twice.  Might be better to put the result of 
cyg_current_time() / 100 in a temporary variable and perform htons() on 
that.

Jay

On 3/9/2011 10:26 AM, bugzilla-daemon@bugs.ecos.sourceware.org wrote:
> Please do not reply to this email. Use the web interface provided at:
> http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001170
>
> --- Comment #1 from Sergei Gavrikov<sergei.gavrikov@gmail.com>  2011-03-09 18:26:22 GMT ---
> Created an attachment (id=1167)
>   -->  (http://bugs.ecos.sourceware.org/attachment.cgi?id=1167)
> Fixed byte order for bp_secs
>
> diffstat /tmp/dhcp_prot.diff
>   ChangeLog       |    5 +++++
>   src/dhcp_prot.c |    2 +-
>   2 files changed, 6 insertions(+), 1 deletion(-)
>
> Grep shows 1 actual place. Hope that's it.
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug 1001170] Correct Endianness of DHCP "Seconds Elapsed" field
  2011-03-09 11:45 [Bug 1001170] New: Correct Endianness of DHCP "Seconds Elapsed" field bugzilla-daemon
  2011-03-09 18:26 ` [Bug 1001170] " bugzilla-daemon
@ 2011-03-10  5:38 ` bugzilla-daemon
  2011-03-10 10:26 ` bugzilla-daemon
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: bugzilla-daemon @ 2011-03-10  5:38 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001170

--- Comment #3 from Sergei Gavrikov <sergei.gavrikov@gmail.com> 2011-03-10 05:38:22 GMT ---
(In reply to comment #2)
> It also appears in bootp_support.c: show_bootp().
> 
> Depending on the implementation of htons(), cyg_current_time() may end
> up getting called twice.  Might be better to put the result of
> cyg_current_time() / 100 in a temporary variable and perform htons()
> on that.
> 
> Jay

Agreed. Thank you for your point. I will re-submit new patch. Or may be 
Kelvin has own one?

Sergei

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug 1001170] Correct Endianness of DHCP "Seconds Elapsed" field
  2011-03-09 11:45 [Bug 1001170] New: Correct Endianness of DHCP "Seconds Elapsed" field bugzilla-daemon
  2011-03-09 18:26 ` [Bug 1001170] " bugzilla-daemon
  2011-03-10  5:38 ` bugzilla-daemon
@ 2011-03-10 10:26 ` bugzilla-daemon
  2011-03-10 13:30 ` bugzilla-daemon
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: bugzilla-daemon @ 2011-03-10 10:26 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001170

--- Comment #4 from Sergei Gavrikov <sergei.gavrikov@gmail.com> 2011-03-10 10:26:33 GMT ---
(In reply to comment #3)
> (In reply to comment #2)
> > It also appears in bootp_support.c: show_bootp().

It seems for me we also should fix==ntohs and 'flags' value there, as
broadcast value shows itself as 0x80 in DHCP dump (on i386 target):

BOOTP[eth0] op: REQUEST
       htype: Ethernet
        hlen: 6
        hops: 0
         xid: 0x14893456
        secs: 0
       flags: 0x80
              ^^^^

What do you think? I mean

--- a/packages/net/common/current/src/bootp_support.c
+++ b/packages/net/common/current/src/bootp_support.c
@@ -274,8 +274,8 @@ show_bootp(const char *intf, struct boot
     diag_printf("        hlen: %d\n", bp->bp_hlen );
     diag_printf("        hops: %d\n", bp->bp_hops );
     diag_printf("         xid: 0x%x\n", bp->bp_xid );
-    diag_printf("        secs: %d\n", bp->bp_secs );
-    diag_printf("       flags: 0x%x\n", bp->bp_flags );
+    diag_printf("        secs: %d\n", ntohs(bp->bp_secs) );
+    diag_printf("       flags: 0x%x\n", ntohs(bp->bp_flags) );

> > Depending on the implementation of htons(), cyg_current_time() may
> > end up getting called twice.  Might be better to put the result of
> > cyg_current_time() / 100 in a temporary variable and perform htons()
> > on that.
> > 
> > Jay
> 
> Agreed. Thank you for your point. I will re-submit new patch. Or may
> be Kelvin has own one?

Well, I can attach a combined patch for the both sources, however,
unfortunately, I cannot test it on BE target.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug 1001170] Correct Endianness of DHCP "Seconds Elapsed" field
  2011-03-09 11:45 [Bug 1001170] New: Correct Endianness of DHCP "Seconds Elapsed" field bugzilla-daemon
                   ` (2 preceding siblings ...)
  2011-03-10 10:26 ` bugzilla-daemon
@ 2011-03-10 13:30 ` bugzilla-daemon
  2011-03-11 17:36 ` bugzilla-daemon
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: bugzilla-daemon @ 2011-03-10 13:30 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001170

Sergei Gavrikov <sergei.gavrikov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #1167|0                           |1
        is obsolete|                            |

--- Comment #5 from Sergei Gavrikov <sergei.gavrikov@gmail.com> 2011-03-10 13:30:04 GMT ---
Created an attachment (id=1169)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=1169)
dhcp: some byte order issues

Added things are discussed in comment #2, and comment #4

$ diffstat dhcp.diff
 ChangeLog           |    7 +++++++
 src/bootp_support.c |    4 ++--
 src/dhcp_prot.c     |    4 +++-
 3 files changed, 12 insertions(+), 3 deletions(-)

Sergei

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug 1001170] Correct Endianness of DHCP "Seconds Elapsed" field
  2011-03-09 11:45 [Bug 1001170] New: Correct Endianness of DHCP "Seconds Elapsed" field bugzilla-daemon
                   ` (3 preceding siblings ...)
  2011-03-10 13:30 ` bugzilla-daemon
@ 2011-03-11 17:36 ` bugzilla-daemon
  2011-03-11 18:25 ` bugzilla-daemon
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: bugzilla-daemon @ 2011-03-11 17:36 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001170

--- Comment #6 from Kelvin Lawson <kelvinl@users.sf.net> 2011-03-11 17:36:37 GMT ---
The proposed changes are fine by me.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug 1001170] Correct Endianness of DHCP "Seconds Elapsed" field
  2011-03-09 11:45 [Bug 1001170] New: Correct Endianness of DHCP "Seconds Elapsed" field bugzilla-daemon
                   ` (4 preceding siblings ...)
  2011-03-11 17:36 ` bugzilla-daemon
@ 2011-03-11 18:25 ` bugzilla-daemon
  2011-03-11 20:08 ` bugzilla-daemon
  2011-03-12  7:07 ` bugzilla-daemon
  7 siblings, 0 replies; 10+ messages in thread
From: bugzilla-daemon @ 2011-03-11 18:25 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001170

--- Comment #7 from Sergei Gavrikov <sergei.gavrikov@gmail.com> 2011-03-11 18:25:18 GMT ---
(In reply to comment #6)
> The proposed changes are fine by me.

Hi Kelvin,

Thank you for your report and testing. If none of maintainers has no
doubts I plan to commit the changes in CVS soon.

Sergei

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug 1001170] Correct Endianness of DHCP "Seconds Elapsed" field
  2011-03-09 11:45 [Bug 1001170] New: Correct Endianness of DHCP "Seconds Elapsed" field bugzilla-daemon
                   ` (5 preceding siblings ...)
  2011-03-11 18:25 ` bugzilla-daemon
@ 2011-03-11 20:08 ` bugzilla-daemon
  2011-03-12  7:07 ` bugzilla-daemon
  7 siblings, 0 replies; 10+ messages in thread
From: bugzilla-daemon @ 2011-03-11 20:08 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001170

--- Comment #8 from Sergei Gavrikov <sergei.gavrikov@gmail.com> 2011-03-11 20:08:03 GMT ---
I got a ticket ;-) Checked-in.  Kelvin, Jay, -- thanks.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug 1001170] Correct Endianness of DHCP "Seconds Elapsed" field
  2011-03-09 11:45 [Bug 1001170] New: Correct Endianness of DHCP "Seconds Elapsed" field bugzilla-daemon
                   ` (6 preceding siblings ...)
  2011-03-11 20:08 ` bugzilla-daemon
@ 2011-03-12  7:07 ` bugzilla-daemon
  7 siblings, 0 replies; 10+ messages in thread
From: bugzilla-daemon @ 2011-03-12  7:07 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001170

Sergei Gavrikov <sergei.gavrikov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |sergei.gavrikov@gmail.com
         Resolution|                            |CURRENTRELEASE

--- Comment #9 from Sergei Gavrikov <sergei.gavrikov@gmail.com> 2011-03-12 07:06:53 GMT ---
Marked as RESOLVED.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-03-12  7:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-09 11:45 [Bug 1001170] New: Correct Endianness of DHCP "Seconds Elapsed" field bugzilla-daemon
2011-03-09 18:26 ` [Bug 1001170] " bugzilla-daemon
2011-03-09 23:59   ` Jay Foster
2011-03-10  5:38 ` bugzilla-daemon
2011-03-10 10:26 ` bugzilla-daemon
2011-03-10 13:30 ` bugzilla-daemon
2011-03-11 17:36 ` bugzilla-daemon
2011-03-11 18:25 ` bugzilla-daemon
2011-03-11 20:08 ` bugzilla-daemon
2011-03-12  7:07 ` bugzilla-daemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).