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
19 * You can also choose to distribute this program under the terms of
20 * the Unmodified Binary Distribution Licence (as given in the file
21 * COPYING.UBDL), provided that you have satisfied its requirements.
24 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
35 #include <ipxe/netdevice.h>
37 #include <ipxe/command.h>
38 #include <ipxe/parseopt.h>
39 #include <usr/dhcpmgmt.h>
40 #include <hci/ifmgmt_cmd.h>
44 * DHCP management commands
48 /** "pxebs" options */
49 struct pxebs_options {};
51 /** "pxebs" option list */
52 static struct option_descriptor pxebs_opts[] = {};
54 /** "pxebs" command descriptor */
55 static struct command_descriptor pxebs_cmd =
56 COMMAND_DESC ( struct pxebs_options, pxebs_opts, 2, 2,
57 "<interface> <server type>" );
62 * @v argc Argument count
63 * @v argv Argument list
64 * @ret rc Return status code
66 static int pxebs_exec ( int argc, char **argv ) {
67 struct pxebs_options opts;
68 struct net_device *netdev;
69 unsigned int pxe_type;
73 if ( ( rc = parse_options ( argc, argv, &pxebs_cmd, &opts ) ) != 0 )
76 /* Parse net device name */
77 if ( ( rc = parse_netdev ( argv[optind], &netdev ) ) != 0 )
80 /* Parse boot server type */
81 if ( ( rc = parse_integer ( argv[ optind + 1 ], &pxe_type ) ) != 0 )
84 /* Perform Boot Server Discovery */
85 if ( ( rc = pxebs ( netdev, pxe_type ) ) != 0 ) {
86 printf ( "Could not discover boot server on %s: %s\n",
87 netdev->name, strerror ( rc ) );
94 /** DHCP management commands */
95 struct command dhcp_commands[] __command = {
98 .exec = ifconf_exec, /* synonym for "ifconf" */