[PATCH 3/5] net: add edev argument to net_set_gateway()
Sascha Hauer
s.hauer at pengutronix.de
Mon Jun 10 00:51:03 PDT 2024
Although we currently can't handle multiple gateways, a gateway is
specific to a network device. Pass the struct eth_device * to
net_set_gateway() for better integration of a real network stack later.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
include/net.h | 2 +-
net/dhcp.c | 2 +-
net/ifup.c | 2 +-
net/net.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/net.h b/include/net.h
index 5a6dd9ca7b..1933623936 100644
--- a/include/net.h
+++ b/include/net.h
@@ -254,7 +254,7 @@ void net_set_serverip(IPaddr_t ip);
const char *net_get_server(void);
void net_set_serverip_empty(IPaddr_t ip);
void net_set_netmask(struct eth_device *edev, IPaddr_t ip);
-void net_set_gateway(IPaddr_t ip);
+void net_set_gateway(struct eth_device *edev, IPaddr_t ip);
void net_set_nameserver(IPaddr_t ip);
void net_set_domainname(const char *name);
IPaddr_t net_get_ip(struct eth_device *edev);
diff --git a/net/dhcp.c b/net/dhcp.c
index e1025bf91b..045ccc0183 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -574,7 +574,7 @@ int dhcp_set_result(struct eth_device *edev, struct dhcp_result *res)
net_set_ip(edev, res->ip);
net_set_netmask(edev, res->netmask);
- net_set_gateway(res->gateway);
+ net_set_gateway(edev, res->gateway);
net_set_nameserver(res->nameserver);
set_res(&global_dhcp_bootfile, res->bootfile);
diff --git a/net/ifup.c b/net/ifup.c
index 2e1a5529a8..c79aa445f5 100644
--- a/net/ifup.c
+++ b/net/ifup.c
@@ -136,7 +136,7 @@ static int source_env_network(struct eth_device *edev)
net_set_ip(edev, ipaddr);
net_set_netmask(edev, netmask);
if (gateway)
- net_set_gateway(gateway);
+ net_set_gateway(edev, gateway);
if (serverip)
net_set_serverip(serverip);
}
diff --git a/net/net.c b/net/net.c
index a9d1306354..4703842f43 100644
--- a/net/net.c
+++ b/net/net.c
@@ -353,7 +353,7 @@ void net_set_netmask(struct eth_device *edev, IPaddr_t nm)
edev->netmask = nm;
}
-void net_set_gateway(IPaddr_t gw)
+void net_set_gateway(struct eth_device *edev, IPaddr_t gw)
{
net_gateway = gw;
}
--
2.39.2
More information about the barebox
mailing list