diff options
author | Enrico Scholz <enrico.scholz@sigma-chemnitz.de> | 2022-08-30 09:37:57 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-08-31 08:31:21 +0200 |
commit | 2295c717eed68cde6b2caf67c12fe9ee4c449f93 (patch) | |
tree | 5871eb59b98f68bdd189cee216445e802af9405c | |
parent | e5f69f82585be23fe31abadb3eb496fb215dc476 (diff) | |
download | barebox-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.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; |