diff options
author | jim-p <jimp@pfsense.org> | 2011-05-16 12:51:27 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2011-05-16 12:51:27 -0400 |
commit | b407b3896374abdeb6bf488e83a1f7a1b5b39639 (patch) | |
tree | 53cde134e4dc584536d9e1981eec65dc313c376b /config/tftp2/tftp.inc | |
parent | 0487143396bc3c349fbd47cce39921594d9f65d3 (diff) | |
download | pfsense-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.inc | 13 |
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; } ?> |