aboutsummaryrefslogtreecommitdiffstats
path: root/config/tftp2/tftp.inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-05-16 12:51:27 -0400
committerjim-p <jimp@pfsense.org>2011-05-16 12:51:27 -0400
commitb407b3896374abdeb6bf488e83a1f7a1b5b39639 (patch)
tree53cde134e4dc584536d9e1981eec65dc313c376b /config/tftp2/tftp.inc
parent0487143396bc3c349fbd47cce39921594d9f65d3 (diff)
downloadpfsense-packages-b407b3896374abdeb6bf488e83a1f7a1b5b39639.tar.gz
pfsense-packages-b407b3896374abdeb6bf488e83a1f7a1b5b39639.tar.bz2
pfsense-packages-b407b3896374abdeb6bf488e83a1f7a1b5b39639.zip
Misc TFTP package fixes. Whitespace, interface selection, adding nat rules, fixing broken links.
Diffstat (limited to 'config/tftp2/tftp.inc')
-rw-r--r--config/tftp2/tftp.inc13
1 files changed, 13 insertions, 0 deletions
diff --git a/config/tftp2/tftp.inc b/config/tftp2/tftp.inc
index 698122d2..a9af5fe3 100644
--- a/config/tftp2/tftp.inc
+++ b/config/tftp2/tftp.inc
@@ -115,6 +115,7 @@ function tftp_deinstall_command() {
}
function tftp_generate_rules($type) {
+ global $config, $FilterIflist;
if ($type != "nat")
return;
// Open inetd.conf write handle
@@ -122,5 +123,17 @@ function tftp_generate_rules($type) {
/* add tftp daemon */
fwrite($inetd_fd, "tftp\t\tdgram\tudp\twait\t\troot\t/usr/libexec/tftpd\ttftpd /tftpboot\n");
fclose($inetd_fd); // Close file handle
+
+ if (!empty($config['installedpackages']['tftpd']['config'][0]['tftpdinterface'])) {
+ $tftpifs = explode(",", $config['installedpackages']['tftpd']['config'][0]['tftpdinterface']);
+ foreach($tftpifs as $tftpif) {
+ if ($FilterIflist[$tftpif]) {
+ log_error("Adding TFTP nat rules");
+ $natrules .= "rdr pass on {$FilterIflist[$tftpif]['if']} proto udp from any to {$FilterIflist[$tftpif]['ip']} port 69 -> 127.0.0.1 port 69\n";
+ $natrules .= "nat on {$FilterIflist[$tftpif]['if']} from 127.0.0.1 to any -> {$FilterIflist[$tftpif]['ip']} port 1024:65535 \n";
+ }
+ }
+ }
+ return $natrules;
}
?>