summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>2022-08-30 09:37:57 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-08-31 08:31:21 +0200
commit2295c717eed68cde6b2caf67c12fe9ee4c449f93 (patch)
tree5871eb59b98f68bdd189cee216445e802af9405c
parente5f69f82585be23fe31abadb3eb496fb215dc476 (diff)
downloadbarebox-2295c717eed68cde6b2caf67c12fe9ee4c449f93.tar.gz
barebox-2295c717eed68cde6b2caf67c12fe9ee4c449f93.tar.xz
tftp: allow to change tftp port
This adds a 'port=<port>' mount option for tftp filesystems. Useful e.g. when working with a local, non-privileged tftp server Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-3-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--fs/tftp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/tftp.c b/fs/tftp.c
index c26204ae76..913ca1df6e 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -30,6 +30,7 @@
#include <linux/stat.h>
#include <linux/err.h>
#include <kfifo.h>
+#include <parseopt.h>
#include <linux/sizes.h>
#define TFTP_PORT 69 /* Well known TFTP port number */
@@ -376,6 +377,7 @@ static struct file_priv *tftp_do_open(struct device_d *dev,
struct file_priv *priv;
struct tftp_priv *tpriv = dev->priv;
int ret;
+ unsigned short port = TFTP_PORT;
priv = xzalloc(sizeof(*priv));
@@ -405,8 +407,9 @@ static struct file_priv *tftp_do_open(struct device_d *dev,
goto out;
}
- priv->tftp_con = net_udp_new(tpriv->server, TFTP_PORT, tftp_handler,
- priv);
+ parseopt_hu(fsdev->options, "port", &port);
+
+ priv->tftp_con = net_udp_new(tpriv->server, port, tftp_handler, priv);
if (IS_ERR(priv->tftp_con)) {
ret = PTR_ERR(priv->tftp_con);
goto out1;