2 * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 FILE_LICENCE ( GPL2_OR_LATER );
31 #include <ipxe/netdevice.h>
33 #include <ipxe/command.h>
34 #include <ipxe/parseopt.h>
35 #include <usr/dhcpmgmt.h>
36 #include <hci/ifmgmt_cmd.h>
40 * DHCP management commands
44 /** "pxebs" options */
45 struct pxebs_options {};
47 /** "pxebs" option list */
48 static struct option_descriptor pxebs_opts[] = {};
50 /** "pxebs" command descriptor */
51 static struct command_descriptor pxebs_cmd =
52 COMMAND_DESC ( struct pxebs_options, pxebs_opts, 2, 2,
53 "<interface> <server type>" );
58 * @v argc Argument count
59 * @v argv Argument list
60 * @ret rc Return status code
62 static int pxebs_exec ( int argc, char **argv ) {
63 struct pxebs_options opts;
64 struct net_device *netdev;
65 unsigned int pxe_type;
69 if ( ( rc = parse_options ( argc, argv, &pxebs_cmd, &opts ) ) != 0 )
72 /* Parse net device name */
73 if ( ( rc = parse_netdev ( argv[optind], &netdev ) ) != 0 )
76 /* Parse boot server type */
77 if ( ( rc = parse_integer ( argv[ optind + 1 ], &pxe_type ) ) != 0 )
80 /* Perform Boot Server Discovery */
81 if ( ( rc = pxebs ( netdev, pxe_type ) ) != 0 ) {
82 printf ( "Could not discover boot server on %s: %s\n",
83 netdev->name, strerror ( rc ) );
90 /** DHCP management commands */
91 struct command dhcp_commands[] __command = {
94 .exec = ifconf_exec, /* synonym for "ifconf" */