From 2295c717eed68cde6b2caf67c12fe9ee4c449f93 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Tue, 30 Aug 2022 09:37:57 +0200 Subject: tftp: allow to change tftp port This adds a 'port=' mount option for tftp filesystems. Useful e.g. when working with a local, non-privileged tftp server Signed-off-by: Enrico Scholz Link: https://lore.barebox.org/20220830073816.2694734-3-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer --- fs/tftp.c | 7 +++++-- 1 file 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 #include #include +#include #include #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; -- cgit v1.2.3