diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2008-06-02 16:13:14 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2008-06-02 16:13:14 +0200 |
commit | dabec3a7a165f7cce58f45c05059c4ee9e2529a9 (patch) | |
tree | 553bd57f2acf645255aba05411e42a51dd6f969b /net | |
parent | 839aaaf9efddeadb5511406697e17db98f718b56 (diff) | |
parent | f65ad993eef7522fcf1a9fa4f6703e4399f5b56b (diff) | |
download | barebox-dabec3a7a165f7cce58f45c05059c4ee9e2529a9.tar.gz barebox-dabec3a7a165f7cce58f45c05059c4ee9e2529a9.tar.xz |
Merge branch 'master' of git://www.denx.de/git/u-boot-v2
Diffstat (limited to 'net')
-rw-r--r-- | net/bootp.c | 52 | ||||
-rw-r--r-- | net/bootp.h | 2 | ||||
-rw-r--r-- | net/eth.c | 1 | ||||
-rw-r--r-- | net/net.c | 66 |
4 files changed, 28 insertions, 93 deletions
diff --git a/net/bootp.c b/net/bootp.c index 7340ed9875..a2415fb88b 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -58,7 +58,7 @@ static void DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len); /* For Debug */ -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX) +#ifdef CONFIG_BOOTP_VENDOREX extern u8 *dhcp_vendorex_prep (u8 *e); /*rtn new e after add own opts. */ extern u8 *dhcp_vendorex_proc (u8 *e); /*rtn next e if mine,else NULL */ #endif @@ -163,7 +163,7 @@ static void BootpVendorFieldProcess (u8 * ext) if (NetOurDNSIP == 0) { NetCopyIP (&NetOurDNSIP, (IPaddr_t *) (ext + 2)); } -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2) +#ifdef CONFIG_BOOTP_DNS2 if ((NetOurDNS2IP == 0) && (size > 4)) { NetCopyIP (&NetOurDNS2IP, (IPaddr_t *) (ext + 2 + 4)); } @@ -347,10 +347,10 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R u8 *start = e; u8 *cnt; -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX) +#ifdef CONFIG_BOOTP_VENDOREX u8 *x; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SEND_HOSTNAME) +#ifdef CONFIG_BOOTP_SEND_HOSTNAME char *hostname; #endif @@ -389,7 +389,7 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R *e++ = tmp >> 8; *e++ = tmp & 0xff; } -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SEND_HOSTNAME) +#ifdef CONFIG_BOOTP_SEND_HOSTNAME if ((hostname = getenv ("hostname"))) { int hostnamelen = strlen (hostname); @@ -400,7 +400,7 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R } #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX) +#ifdef CONFIG_BOOTP_VENDOREX if ((x = dhcp_vendorex_prep (e))) return x - start; #endif @@ -408,39 +408,39 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R *e++ = 55; /* Parameter Request List */ cnt = e++; /* Pointer to count of requested items */ *cnt = 0; -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SUBNETMASK) +#ifdef CONFIG_BOOTP_SUBNETMASK *e++ = 1; /* Subnet Mask */ *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_TIMEOFFSET) +#ifdef CONFIG_BOOTP_TIMEOFFSET *e++ = 2; *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_GATEWAY) +#ifdef CONFIG_BOOTP_GATEWAY *e++ = 3; /* Router Option */ *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS) +#ifdef CONFIG_BOOTP_DNS *e++ = 6; /* DNS Server(s) */ *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_HOSTNAME) +#ifdef CONFIG_BOOTP_HOSTNAME *e++ = 12; /* Hostname */ *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTFILESIZE) +#ifdef CONFIG_BOOTP_BOOTFILESIZE *e++ = 13; /* Boot File Size */ *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTPATH) +#ifdef CONFIG_BOOTP_BOOTPATH *e++ = 17; /* Boot path */ *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NISDOMAIN) +#ifdef CONFIG_BOOTP_NISDOMAIN *e++ = 40; /* NIS Domain name request */ *cnt += 1; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NTPSERVER) +#ifdef CONFIG_BOOTP_NTPSERVER *e++ = 42; *cnt += 1; #endif @@ -479,43 +479,43 @@ static int BootpExtended (u8 * e) *e++ = (576 - 312 + OPT_SIZE) & 0xff; #endif /* CFG_CMD_DHCP */ -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SUBNETMASK) +#ifdef CONFIG_BOOTP_SUBNETMASK *e++ = 1; /* Subnet mask request */ *e++ = 4; e += 4; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_GATEWAY) +#ifdef CONFIG_BOOTP_GATEWAY *e++ = 3; /* Default gateway request */ *e++ = 4; e += 4; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS) +#ifdef CONFIG_BOOTP_DNS *e++ = 6; /* Domain Name Server */ *e++ = 4; e += 4; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_HOSTNAME) +#ifdef CONFIG_BOOTP_HOSTNAME *e++ = 12; /* Host name request */ *e++ = 32; e += 32; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTFILESIZE) +#ifdef CONFIG_BOOTP_BOOTFILESIZE *e++ = 13; /* Boot file size */ *e++ = 2; e += 2; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_BOOTPATH) +#ifdef CONFIG_BOOTP_BOOTPATH *e++ = 17; /* Boot path */ *e++ = 32; e += 32; #endif -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NISDOMAIN) +#ifdef CONFIG_BOOTP_NISDOMAIN *e++ = 40; /* NIS Domain name request */ *e++ = 32; e += 32; @@ -616,7 +616,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp) case 1: NetCopyIP (&NetOurSubnetMask, (popt + 2)); break; -#if (CONFIG_COMMANDS & CFG_CMD_SNTP) && (CONFIG_BOOTP_MASK & CONFIG_BOOTP_TIMEOFFSET) +#if defined CONFIG_NET_SNTP && defined CONFIG_BOOTP_TIMEOFFSET case 2: /* Time offset */ NetCopyLong (&NetTimeOffset, (ulong *) (popt + 2)); NetTimeOffset = ntohl (NetTimeOffset); @@ -627,7 +627,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp) break; case 6: NetCopyIP (&NetOurDNSIP, (popt + 2)); -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2) +#ifdef CONFIG_BOOTP_DNS2 if (*(popt + 1) > 4) { NetCopyIP (&NetOurDNS2IP, (popt + 2 + 4)); } @@ -645,7 +645,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp) memcpy (&NetOurRootPath, popt + 2, size); NetOurRootPath[size] = 0; break; -#if (CONFIG_COMMANDS & CFG_CMD_SNTP) && (CONFIG_BOOTP_MASK & CONFIG_BOOTP_NTPSERVER) +#if defined CONFIG_NET_SNTP && defined CONFIG_BOOTP_NTPSERVER case 42: /* NTP server IP */ NetCopyIP (&NetNtpServerIP, (popt + 2)); break; @@ -691,7 +691,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp) } break; default: -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_VENDOREX) +#ifdef CONFIG_BOOTP_VENDOREX if (dhcp_vendorex_proc (popt)) break; #endif diff --git a/net/bootp.h b/net/bootp.h index 0b3163901e..f5529f7ecc 100644 --- a/net/bootp.h +++ b/net/bootp.h @@ -18,7 +18,7 @@ /* * BOOTP header. */ -#if (CONFIG_COMMANDS & CFG_CMD_DHCP) +#ifdef CONFIG_NET_DHCP #define OPT_SIZE 312 /* Minimum DHCP Options size per RFC2131 - results in 576 byte pkt */ #else #define OPT_SIZE 64 @@ -27,7 +27,6 @@ #include <init.h> #include <net.h> #include <miiphy.h> -#include <malloc.h> #include <errno.h> static struct eth_device *eth_current; @@ -107,7 +107,7 @@ IPaddr_t NetOurSubnetMask=0; /* Our subnet mask (0=unknown) */ IPaddr_t NetOurGatewayIP=0; /* Our gateways IP address */ IPaddr_t NetOurDNSIP=0; /* Our DNS IP address */ -#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2) +#ifdef CONFIG_BOOTP_DNS2 IPaddr_t NetOurDNS2IP=0; /* Our 2nd DNS IP address */ #endif char NetOurNISDomain[32]={0,}; /* Our NIS domain */ @@ -130,10 +130,6 @@ uchar NetBcastAddr[6] = /* Ethernet bcast address */ { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; uchar NetEtherNullAddr[6] = { 0, 0, 0, 0, 0, 0 }; -#if (CONFIG_COMMANDS & CFG_CMD_CDP) -uchar NetCDPAddr[6] = /* Ethernet bcast address */ - { 0x01, 0x00, 0x0c, 0xcc, 0xcc, 0xcc }; -#endif int NetState; /* Network loop state */ /* XXX in both little & big endian machines 0xFFFF == ntohs(-1) */ @@ -148,10 +144,6 @@ IPaddr_t NetPingIP; /* the ip address to ping */ extern void PingStart(void); #endif -#if (CONFIG_COMMANDS & CFG_CMD_CDP) -static void CDPStart(void); -#endif - #ifdef CONFIG_NET_SNTP IPaddr_t NetNtpServerIP; /* NTP server IP address */ int NetTimeOffset=0; /* offset time from UTC */ @@ -358,10 +350,6 @@ restart: NetServerIP = dev_get_param_ip(eth_current->dev, "serverip"); NetOurVLAN = getenv_VLAN("vlan"); /* VLANs must be read */ NetOurNativeVLAN = getenv_VLAN("nvlan"); - case CDP: - NetOurVLAN = getenv_VLAN("vlan"); /* VLANs must be read */ - NetOurNativeVLAN = getenv_VLAN("nvlan"); - break; default: break; } @@ -410,11 +398,6 @@ restart: NfsStart(); break; #endif -#if (CONFIG_COMMANDS & CFG_CMD_CDP) - case CDP: - CDPStart(); - break; -#endif #ifdef CONFIG_NETCONSOLE case NETCONS: NcStart(); @@ -433,19 +416,6 @@ restart: break; } -#if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII) -#if defined(CFG_FAULT_ECHO_LINK_DOWN) && defined(CONFIG_STATUS_LED) && defined(STATUS_LED_RED) - /* - * Echo the inverted link state to the fault LED. - */ - if(miiphy_link(eth_get_dev()->name, CFG_FAULT_MII_ADDR)) { - status_led_set (STATUS_LED_RED, STATUS_LED_OFF); - } else { - status_led_set (STATUS_LED_RED, STATUS_LED_ON); - } -#endif /* CFG_FAULT_ECHO_LINK_DOWN, ... */ -#endif /* CONFIG_MII, ... */ - /* * Main packet reception loop. Loop receiving packets until * someone sets `NetState' to a state that terminates. @@ -481,21 +451,6 @@ restart: */ if (timeHandler && is_timeout(timeStart, timeDelta)) { thand_f *x; - -#if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII) -# if defined(CFG_FAULT_ECHO_LINK_DOWN) && \ - defined(CONFIG_STATUS_LED) && \ - defined(STATUS_LED_RED) - /* - * Echo the inverted link state to the fault LED. - */ - if(miiphy_link(eth_get_dev()->name, CFG_FAULT_MII_ADDR)) { - status_led_set (STATUS_LED_RED, STATUS_LED_OFF); - } else { - status_led_set (STATUS_LED_RED, STATUS_LED_ON); - } -# endif /* CFG_FAULT_ECHO_LINK_DOWN, ... */ -#endif /* CONFIG_MII, ... */ x = timeHandler; timeHandler = (thand_f *)0; (*x)(); @@ -648,9 +603,6 @@ NetReceive(uchar * inpkt, int len) IPaddr_t tmp; int x; uchar *pkt; -#if (CONFIG_COMMANDS & CFG_CMD_CDP) - int iscdp; -#endif ushort cti = 0, vlanid = VLAN_NONE, myvlanid, mynvlanid; #ifdef ET_DEBUG @@ -665,11 +617,6 @@ NetReceive(uchar * inpkt, int len) if (len < ETHER_HDR_SIZE) return; -#if (CONFIG_COMMANDS & CFG_CMD_CDP) - /* keep track if packet is CDP */ - iscdp = memcmp(et->et_dest, NetCDPAddr, 6) == 0; -#endif - myvlanid = ntohs(NetOurVLAN); if (myvlanid == (ushort)-1) myvlanid = VLAN_NONE; @@ -708,9 +655,6 @@ NetReceive(uchar * inpkt, int len) /* if no VLAN active */ if ((ntohs(NetOurVLAN) & VLAN_IDMASK) == VLAN_NONE -#if (CONFIG_COMMANDS & CFG_CMD_CDP) - && iscdp == 0 -#endif ) return; @@ -726,13 +670,6 @@ NetReceive(uchar * inpkt, int len) printf("Receive from protocol 0x%x\n", x); #endif -#if (CONFIG_COMMANDS & CFG_CMD_CDP) - if (iscdp) { - CDPHandler((uchar *)ip, len); - return; - } -#endif - if ((myvlanid & VLAN_IDMASK) != VLAN_NONE) { if (vlanid == VLAN_NONE) vlanid = (mynvlanid & VLAN_IDMASK); @@ -1042,7 +979,6 @@ static int net_check_prereq (proto_t protocol) case DHCP: case RARP: case BOOTP: - case CDP: if (memcmp (NetOurEther, "\0\0\0\0\0\0", 6) == 0) { printf("*** ERROR: `%s.ethaddr' not set\n", ethid); return (1); |