[3449] in linux-net channel archive

home help back first fref pref prev next nref lref last post

Re: bootptest sends out HW addr 000000000000

daemon@ATHENA.MIT.EDU (Jon Peatfield)
Mon Jun 24 10:14:01 1996

To: Antoon Frehe <a.frehe@et.tudelft.nl>
cc: submit-linux-dev-net@ratatosk.yggdrasil.com, jp107@damtp.cam.ac.uk
In-reply-to: Your message of "Fri, 21 Jun 1996 11:19:18 +0200."
             <31CA6916.2C6F@et.tudelft.nl> 
Date: 	Mon, 24 Jun 1996 14:37:04 +0100
From: Jon Peatfield <J.S.Peatfield@damtp.cam.ac.uk>

What do you actually want to test replies to other machines?  Here is a patch 
to allow bootptest to send requests "from" any MAC address you like:

--cut-here--
*** bootptest.c	Tue Mar 12 15:04:28 1996
--- bootptest.c.orig	Thu Feb 16 15:36:25 1995
***************
*** 194,222 ****
  			use_hwa = 1;
  			break;
  
- 		case 'H':				 /* get the MAC address from user */
- 			{ int err, count, i ;
- 			  unsigned int value ;
- 			  char cc, *ptr ;
- 
- 			  if (argc < 2)
- 				  goto error;
- 			  argc--; argv++;
- 			  ptr = *argv ;
- 			  for (i=0; i < 6; ++i) {
- 				  err = sscanf(ptr,
- 								 "%2x%n%[ :.]%n", &value,&count,&cc,&count) ;
- 				  eaddr[i] = value ;
- 				  if (err <= 0) {   /* Not enough given */
- 					  fprintf(stderr, "Ran out of hwaddr, ignoring\n") ;
- 					  break ;
- 				  }
- 				  ptr += count ;
- 			  }
- 			  use_hwa = 2;
- 		  };
- 			break;
- 
  		case 'm':				/* Magic number value. */
  			if (argc < 2)
  				goto error;
--- 194,199 ----
***************
*** 335,353 ****
  	/*
  	 * Fill in the hardware address (or client IP address)
  	 */
! 	if (use_hwa) {  /* 1 means use our addr, 2 means use one provided */
! 		if (use_hwa == 1) {
! 			struct ifreq *ifr;
! 
! 			ifr = getif(s, &sin_server.sin_addr);
! 			if (!ifr) {
! 				printf("No interface for %s\n", servername);
! 				exit(1);
! 			}
! 			if (getether(ifr->ifr_name, (char*)eaddr)) {
! 				printf("Can not get ether addr for %s\n", ifr->ifr_name);
! 				exit(1);
! 			}
  		}
  		/* Copy Ethernet address into request packet. */
  		bp->bp_htype = 1;
--- 312,328 ----
  	/*
  	 * Fill in the hardware address (or client IP address)
  	 */
! 	if (use_hwa) {
! 		struct ifreq *ifr;
! 
! 		ifr = getif(s, &sin_server.sin_addr);
! 		if (!ifr) {
! 			printf("No interface for %s\n", servername);
! 			exit(1);
! 		}
! 		if (getether(ifr->ifr_name, (char*)eaddr)) {
! 			printf("Can not get ether addr for %s\n", ifr->ifr_name);
! 			exit(1);
  		}
  		/* Copy Ethernet address into request packet. */
  		bp->bp_htype = 1;
--cut-here--

The code in bootptest is supposed to extract the MAC address when you use the 
-h option.  If it doesn't then this suggests a problem with the method they 
are using to determine the address.  What version of Linux (kernel) are you 
running on?

My memory of the bootptest code is that it runs down a list of interfaces, and 
chooses the last, this may not be what you want...

Of course you can also use my bootpc to see what replies you would have got...

 -- Jon



home help back first fref pref prev next nref lref last post