Skip to contentSkip to conversation

2/9: bootp

PATCH New Robert Schwebel 3 participants 7 messages Mar 6, 2003 – Mar 7, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2/9: bootp

BOOTP
=====

- bug: when accessing data inside a network packet you must use NetCopyIP. When accessing data directly via pointers you can be biten by the processor's 32 bit alignment.

Robert

Signature · 53 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Braunschweiger Str. 79,  31134 Hildesheim, Germany
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
-------------- next part --------------
diff -urN -x CVS -x ptx-patches -x logfile -x logfile1 u-boot/net/bootp.c u-boot-ptx/net/bootp.c
--- u-boot/net/bootp.c	2002-09-28 01:19:37.000000000 +0200
+++ u-boot-ptx/net/bootp.c	2003-02-11 19:42:44.000000000 +0100
@@ -8,10 +8,11 @@
  *	Copyright 2000-2002 Wolfgang Denk, wd at denx.de
  */
 
-#if 0
-#define	DEBUG		1	/* general debug */
-#define DEBUG_BOOTP_EXT	1	/* Debug received vendor fields	*/
-#endif
+//#define	DEBUG		1	/* general debug */
+//#define DEBUG_BOOTP_EXT	1	/* Debug received vendor fields	*/
+#undef  DEBUG
+#undef  DEBUG_BOOTP_EXT
+
 
 #ifdef DEBUG_BOOTP_EXT
 #define debug_ext(fmt,args...)	printf (fmt ,##args)
@@ -752,8 +753,10 @@
 	volatile uchar *pkt, *iphdr;
 	Bootp_t *bp;
 	int pktlen, iplen, extlen;
+	IPaddr_t OfferedIP;
 
 	debug ("DhcpSendRequestPkt: Sending DHCPREQUEST\n");
+
 	pkt = NetTxPacket;
 	memset ((void*)pkt, 0, PKTSIZE);
 
@@ -784,13 +787,16 @@
 	/*
 	 * Copy options from OFFER packet if present
 	 */
-	extlen = DhcpExtended(bp->bp_vend, DHCP_REQUEST, NetServerIP, bp->bp_yiaddr);
+
+	NetCopyIP(&OfferedIP, &bp->bp_yiaddr);
+	extlen = DhcpExtended(bp->bp_vend, DHCP_REQUEST, NetServerIP, OfferedIP);
 
 	pktlen = BOOTP_SIZE - sizeof(bp->bp_vend) + extlen;
 	iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + extlen;
 	NetSetIP(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
 
 	debug ("Transmitting DHCPREQUEST packet: len = %d\n", pktlen);
+
 	NetSendPacket(NetTxPacket, pktlen);
 }
#1 lore raw

PATCH 1/1 2/9: bootp

Quoted 7 lines · In message <[email protected]> you wrote:

BOOTP
=====

- bug: when accessing data inside a network packet you must use NetCopyIP. When accessing data directly via pointers you can be biten by the processor's 32 bit alignment.

Thanks for pointing out.

Review

Quoted 8 lines
(quoted diff) +4 -4
-#if 0
-#define	DEBUG		1	/* general debug */
-#define DEBUG_BOOTP_EXT	1	/* Debug received vendor fields	*/
-#endif
+//#define	DEBUG		1	/* general debug */
+//#define DEBUG_BOOTP_EXT	1	/* Debug received vendor fields	*/
+#undef  DEBUG
+#undef  DEBUG_BOOTP_EXT

Rejected.

I will not change 4 lines when the old siolution needs to change just 1 char.

Also, please NEVER use C++ comments in U-Boot code.

Review line 756

Quoted 7 lines

#ifdef DEBUG_BOOTP_EXT
#define debug_ext(fmt,args...) printf (fmt ,##args)

(quoted diff) +1 -0
@@ -752,8 +753,10 @@
 	volatile uchar *pkt, *iphdr;
 	Bootp_t *bp;
 	int pktlen, iplen, extlen;
+	IPaddr_t OfferedIP;

...

Added.

Wolfgang Denk

Signature · 3 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
I still miss my ex-wife, but my aim is getting better.
#2 lore raw

PATCH 1/1 2/9: bootp

Quoted 11 lines · Wolfgang Denk

Review

Quoted 8 lines
(quoted diff) +4 -4
-#if 0
-#define	DEBUG		1	/* general debug */
-#define DEBUG_BOOTP_EXT	1	/* Debug received vendor fields	*/
-#endif
+//#define	DEBUG		1	/* general debug */
+//#define DEBUG_BOOTP_EXT	1	/* Debug received vendor fields	*/
+#undef  DEBUG
+#undef  DEBUG_BOOTP_EXT

Rejected.

Quoted 2 lines

I will not change 4 lines when the old siolution needs to change just 1 char.

We need a unified debug message scheme in u-boot. What we currently have is a complete mess.

Quoted 1 line

Also, please NEVER use C++ comments in U-Boot code.

Well, I see, you are very consequent with your maintainer policy:

robert at ganymed:~/embedded/cvs/u-boot> find . -name "*.[hc]" | xargs grep "//" | wc -l
1707

Robert

Signature · 5 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Braunschweiger Str. 79,  31134 Hildesheim, Germany
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
#3 lore raw

PATCH 1/1 2/9: bootp

Quoted 3 lines · In message <[email protected]> you wrote:

We need a unified debug message scheme in u-boot. What we currently have is a complete mess.

;-)

Quoted 3 lines
Quoted 1 line

Also, please NEVER use C++ comments in U-Boot code.

Well, I see, you are very consequent with your maintainer policy:

At least I reject patches whenever I find //

Some things escape me, though, or I don't have enough time or I feel it's not really helpful.

Robert, what do you want to demonstrate?

That U-Boot was not written by one single person, stickng to exactly one coding style? That there are deficiencies, both formal and functional?

What you do right now is not helpful. You have enough experience to provide really valuable input - see some of your previous patches. Please try to focus on substantial things, and concentrate on fixes and extensions.

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
The only way to learn a new programming language is by  writing  pro-
grams in it.                                        - Brian Kernighan
#4 lore raw

PATCH 1/1 2/9: bootp

Quoted 10 lines · Wolfgang Denk

Robert, what do you want to demonstrate?

That U-Boot was not written by one single person, stickng to exactly one coding style? That there are deficiencies, both formal and functional?

What you do right now is not helpful. You have enough experience to provide really valuable input - see some of your previous patches. Please try to focus on substantial things, and concentrate on fixes and extensions.

You want open words, ok, here we go.

Don't get me wrong, I generally have no problem with maintainers rejecting my patches. It's quite normal that maintainers know their projects much better than I do, so I'm used to going back to the lab and reworking stuff when it's necessary.

My problem is that your argumentation regarding the "little things" is not easily understandable. You have a document in your code which says that Linux coding style should be used. If I send patches which fix coding style (and yes, it's only in source files I have worked on, otherwhise I wouldn't have found it) they are rejected. You say: improve documentation; if I find something and do it you reject it because it is not _exactly_ how you would have done it or how you did it. I try to improve usability by making help messages more understandable, because I, when I first tried to _use_ them didn't understand them and had to look at the source first (every good engineer should know how important the grandma test is ;). You reject them because I add 10 bytes to a 100 KiB bootloader. I try to improve #ifdef mess (and there's a lot of it left, I can tell you!) by using all the well known techniques like debug macros etc. You reject them because it doesn't change functionality. I try to make code better readable by unsing correct indentation - you reject it. Then, after all that 'it-doesn't-matter-how-the-code-looks- like-if-it-works' I add two lines with

//#define foo
#undef foo

and you tell me that it's against the coding style. My impression is that you didn't care a single bit about coding style with the other 3.2 MiB of the code, so why do you care about my little improvements? It's not that easy to understand.

Wolfgang, all these puzzle pieces are not worth to be mentioned when you see them separately, and I definitely have better things to do than starting flame wars. But all that stuff together - including your sometimes a little bit rude RTFM postings addressed to people who are _not_ as deep into the project as you are - definitely don't improve the mood of the developers here.

Enough said - I would love to see an open discussion about how to improve the coding style / #ifdef problems.

Robert

Signature · 5 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Braunschweiger Str. 79,  31134 Hildesheim, Germany
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
#5 lore raw

PATCH 1/1 2/9: bootp

Hi Robert,

Quoted 2 lines · in message <[email protected]> you wrote:

Don't get me wrong, I generally have no problem with maintainers

I hope you don't have any (real) problems with me, either. If I was too harsh or peevishly please try to lean back, have a beer, and accept my sincere apology. I _am_ short of time, and maybe sometimes I should rather not reply at all.

Quoted 2 lines

My problem is that your argumentation regarding the "little things" is not easily understandable. You have a document in your code which says

I can understand that it's difficult to understand. I make a lot of compromises, trying to lump together the different requirements of people wanting to see their patches go into the CVS tree, project schedules, code stability, and style.

I cannot always check style, and for larger contributions it's often simply not practicable to strictly enforce one coding style, or one way how to implement debugging.

So please, relax a bit, and forgive me if I was unfair or impertinent.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Ernest asks Frank how long he has been working for the company.
        "Ever since they threatened to fire me."
#6 lore raw

PATCH 1/1 2/9: bootp

Quoted 4 lines · Wolfgang Denk

I hope you don't have any (real) problems with me, either. If I was too harsh or peevishly please try to lean back, have a beer, and accept my sincere apology. I _am_ short of time, and maybe sometimes I should rather not reply at all.

Wolfgang, I know you personally and I'm pretty sure that often when you tell people to shut up and do their homework before opening their mouth again you surely often don't mean it the way it sounds on the list. I know that it's much more easy in the email world to start flamewars than in real life and that people say things that they would never say when they talked directly to each other.

So all I wish for the future is that you read your mails again before you send them and try to find out what _you_ would feel about it if you were the sender of the original mail (be it somebody with very little experience in porting u-boot, a board maintainer or just a person who is generally interested in the project).

Quoted 1 line

So please, relax a bit, and forgive me if I was unfair or impertinent.

Added to the repository :-)

Robert

Signature · 5 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Braunschweiger Str. 79,  31134 Hildesheim, Germany
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4