This is the mail archive of the mailing list for the eCos project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug 1001170] Correct Endianness of DHCP "Seconds Elapsed" field

Please do not reply to this email. Use the web interface provided at:

--- Comment #4 from Sergei Gavrikov <> 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):

       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:
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]