summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-11-28 08:48:12 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-12-01 12:33:33 +0100
commitba61b249609d28a2a3e750b3602d1ba2a8d8b140 (patch)
tree373108ecc790816e1607cdcae7da471f58d99de0 /net
parent42ee615ff03a0631c5c742c2f739dca4f77ac6d1 (diff)
downloadbarebox-ba61b249609d28a2a3e750b3602d1ba2a8d8b140.tar.gz
barebox-ba61b249609d28a2a3e750b3602d1ba2a8d8b140.tar.xz
net: Add and use IP_BROADCAST
Rather than using the hardcoded value 0xffffffff in several places add a define for the broadcast IP. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'net')
-rw-r--r--net/dhcp.c2
-rw-r--r--net/net.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/net/dhcp.c b/net/dhcp.c
index c5386fe942..4d74733d37 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -661,7 +661,7 @@ int dhcp(int retries, struct dhcp_req_param *param)
if (!retries)
retries = DHCP_DEFAULT_RETRY;
- dhcp_con = net_udp_new(0xffffffff, PORT_BOOTPS, dhcp_handler, NULL);
+ dhcp_con = net_udp_new(IP_BROADCAST, PORT_BOOTPS, dhcp_handler, NULL);
if (IS_ERR(dhcp_con)) {
ret = PTR_ERR(dhcp_con);
goto out;
diff --git a/net/net.c b/net/net.c
index 12e63c664e..205543a425 100644
--- a/net/net.c
+++ b/net/net.c
@@ -276,7 +276,7 @@ static struct net_connection *net_new(IPaddr_t dest, rx_handler_f *handler,
}
/* If we don't have an ip only broadcast is allowed */
- if (!edev->ipaddr && dest != 0xffffffff)
+ if (!edev->ipaddr && dest != IP_BROADCAST)
return ERR_PTR(-ENETDOWN);
con = xzalloc(sizeof(*con));
@@ -291,7 +291,7 @@ static struct net_connection *net_new(IPaddr_t dest, rx_handler_f *handler,
con->icmp = (struct icmphdr *)(con->packet + ETHER_HDR_SIZE + sizeof(struct iphdr));
con->handler = handler;
- if (dest == 0xffffffff) {
+ if (dest == IP_BROADCAST) {
memset(con->et->et_dest, 0xff, 6);
} else {
ret = arp_request(dest, con->et->et_dest);
@@ -525,7 +525,7 @@ static int net_handle_ip(struct eth_device *edev, unsigned char *pkt, int len)
goto bad;
tmp = net_read_ip(&ip->daddr);
- if (edev->ipaddr && tmp != edev->ipaddr && tmp != 0xffffffff)
+ if (edev->ipaddr && tmp != edev->ipaddr && tmp != IP_BROADCAST)
return 0;
switch (ip->protocol) {