Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Commit

Permalink
server: enable TFTP port from CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
Andres Gomez authored and icb- committed Apr 10, 2022
1 parent 540f20c commit 90c263d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ The following are arguments that can be passed to `pypxe.server` when running fr
|Argument|Description|Default|
|---|---|---|
|__`--tftp-server-ip TFTP_SERVER_IP`__|Specify TFTP server IP address|`0.0.0.0`|
|__`--tftp-port TFTP_PORT`__|Specify TFTP server Port|69|

##### HTTP Service Arguments

Expand Down
1 change: 1 addition & 0 deletions example_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"STATIC_CONFIG": "",
"SYSLOG_PORT": 514,
"SYSLOG_SERVER": null,
"TFTP_PORT": 69,
"TFTP_SERVER_IP": "192.168.2.2",
"USE_DHCP": true,
"USE_HTTP": false,
Expand Down
3 changes: 3 additions & 0 deletions pypxe/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
'STATIC_CONFIG':'',
'SYSLOG_SERVER':None,
'SYSLOG_PORT':514,
'TFTP_PORT':69,
'TFTP_SERVER_IP':'0.0.0.0',
'USE_IPXE':False,
'USE_HTTP':False,
Expand Down Expand Up @@ -118,6 +119,7 @@ def parse_cli_arguments():

# TFTP server arguments
tftp_group = parser.add_argument_group(title = 'TFTP', description = 'Arguments relevant to the TFTP server')
tftp_group.add_argument('--tftp-port', action = 'store', dest = 'TFTP_PORT', help = 'TFTP Server Port', default = SETTINGS['TFTP_PORT'])
tftp_group.add_argument('--tftp-server-ip', action = 'store', dest = 'TFTP_SERVER_IP', help = 'TFTP Server IP', default = SETTINGS['TFTP_SERVER_IP'])

return parser.parse_args()
Expand Down Expand Up @@ -225,6 +227,7 @@ def main():
mode_verbose = do_verbose('tftp'),
logger = tftp_logger,
netboot_directory = args.NETBOOT_DIR,
port = args.TFTP_PORT,
ip = args.TFTP_SERVER_IP)
tftpd = threading.Thread(target = tftp_server.listen)
tftpd.daemon = True
Expand Down

0 comments on commit 90c263d

Please sign in to comment.