mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 3/5] net: add edev argument to net_set_gateway()
Date: Mon, 10 Jun 2024 09:51:03 +0200	[thread overview]
Message-ID: <20240610075105.812496-4-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20240610075105.812496-1-s.hauer@pengutronix.de>

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@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




  parent reply	other threads:[~2024-06-10  7:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-10  7:51 [PATCH 0/5] net: preparations for integrating a network stack Sascha Hauer
2024-06-10  7:51 ` [PATCH 1/5] net: virtio-net: allow to set current MAC address Sascha Hauer
2024-06-10  7:51 ` [PATCH 2/5] net: ifup: use accessor to set network device ip/netmask Sascha Hauer
2024-06-10  7:51 ` Sascha Hauer [this message]
2024-06-10  7:51 ` [PATCH 4/5] net: establish single code path for setting edev parameters Sascha Hauer
2024-06-10  7:51 ` [PATCH 5/5] net: host command: move to commands/ Sascha Hauer
2024-06-13  6:41 ` [PATCH 0/5] net: preparations for integrating a network stack Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240610075105.812496-4-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox