Jeremy Kerr [Thu, 16 Jan 2014 01:13:20 +0000 (09:13 +0800)]
discover: Bring down configured interfaces on discover server exit.
We want to down the interfaces that we brought up, so hook up the
network_shutdown function to the discover exit path. Also, we only want
to down interfaces that we've configured, and exclude lo.
Jeremy Kerr [Tue, 14 Jan 2014 07:44:10 +0000 (15:44 +0800)]
lib/process: Add add_stderr flag to process module
For some process execution functions, we'd like to capture stderr as
well as stdout. Currently, we unconditionally redirect subprocess stderr
to the petitboot log file.
This change adds an add_stderr flag to struct process, which indicates
to the process library that we want stderr as well as stdout. If this is
specified, the subprocess' stderr is captured to stdout_buf.
Jeremy Kerr [Tue, 14 Jan 2014 02:56:41 +0000 (10:56 +0800)]
discover/yaboot: Clear globals_done when we see an image definition
Currently, we have a bug where a 'known_name' that appears before an
image section will cause globals_done to be set, and we don't see any
further global variables.
This change sets globals_done only once we see an image section.
Jeremy Kerr [Mon, 23 Dec 2013 08:42:21 +0000 (16:42 +0800)]
config/powerpc: Always call update_network_config
Currently, we have a bug when setting the default network configuration
(ie, no devices have any specific config), as we won't call
update_network_config to clear out the value of the petitboot,network
parameter.
This change always invokes update_network_config, regardless of the
number of interfaces configured. This ensures we clear out the
petitboot,network param, which is then synced to nvram if the param has
changed.
We'd like to do some validation of the system configuration parameters,
so add a few validation types to the widget code. We currently need
integer, ipv4 address and multiple ipv4 address types. These are
implemented as small wrappers around the ncurses form validator code.
Jeremy Kerr [Mon, 16 Dec 2013 02:49:29 +0000 (10:49 +0800)]
sysinfo: Add interface link status to sysinfo data
This changes adds a 'link' parameter to the interface information sent
in sysinfo messages. The discover network code populates this from the
incoming netlink messages.
Jeremy Kerr [Thu, 5 Dec 2013 06:32:28 +0000 (14:32 +0800)]
discover/boot: Fix condition for updating boot params
In commit 823958fb, we change to use struct process, but left in the
check for rc == BOOT_HOOK_EXIT_UPDATE. We actually want to check
process->exit_status here, not rc.
Jeremy Kerr [Tue, 3 Dec 2013 07:14:53 +0000 (15:14 +0800)]
discover/grub2: Fixes for bison 3.x
YYLEX_PARAM is removed in bison 3.0, so we need to pass the scanner
param directly through yyparse (rather than referencing
parser->scanner). Unfortunately, we don't have the lexer header
available at the time we declare yyparse, so we need to pass a void *
here.
Jeremy Kerr [Fri, 29 Nov 2013 02:47:10 +0000 (10:47 +0800)]
discover: Fix CDROM handling
Currently, we don't handle CDROM devices well; we'll try to mount on
boot, and not detect any media changes. Also, the default rules shipping
with udev will put the CDROM tray into a locked state, blocking eject
from working.
This change adds a set of cdrom utility functions, which the udev code
can use to properly initialise cdrom devices and handle eject and media
change requests.
In an upcoming change, we'll populate $prefix (which is used to locate
the environment file) based on the location of the config file, so these
paths will need to be consistent.
Jeremy Kerr [Fri, 22 Nov 2013 06:12:59 +0000 (14:12 +0800)]
ui/ncurses/nc-widgets: Unify select key
We have a few instances where we check for a 'select' action (enter or
space key event), and some are inconsistent. Unify these with a
key_is_select() function.
Jeremy Kerr [Tue, 19 Nov 2013 06:39:41 +0000 (17:39 +1100)]
ui/ncurses: Fix use-after-free when exiting boot option editor
After we've called on_exit, we can no longer use the boot editor. This
change moves individual button callbacks into process_key, which returns
to the main loop.
Jeremy Kerr [Tue, 19 Nov 2013 00:52:49 +0000 (11:52 +1100)]
ui/ncurses: Draw boot editor into a scrollable pad
Like the config editor, draw the boot editor into a pad instead of
directly into the sub window. This means that long device lists will be
handled correctly.
Jeremy Kerr [Sun, 17 Nov 2013 08:36:55 +0000 (19:36 +1100)]
ui/ncurses: Add device selector to boot editor
Rather than expecting users to enter full (prefixed) mount paths, add a
select widget to pick a device, and we automatically add the prefix when
the form is submitted.
Jeremy Kerr [Sun, 17 Nov 2013 03:04:08 +0000 (14:04 +1100)]
ui/ncurses: Make boot editor API consistent with config & sysinfo screens
The boot-editor API is a little more exposed than it needs to be: the
boot_editor struct does not need to be available to other files, and the
init function and on_exit functions differ from those provided for the
config and sysinfo screens.
This change unifies the boot_editor API with those for the other
screens.
Jeremy Kerr [Tue, 19 Nov 2013 04:25:43 +0000 (15:25 +1100)]
discover: Use pxeconffile for udhcpc option name
The patch that went upstream for udhcpc's option 209 handling uses the
option name 'pxeconffile' rather than 'conffile', and it was added as a
non-default option:
Jeremy Kerr [Fri, 25 Oct 2013 01:19:35 +0000 (09:19 +0800)]
nui/ncurses: Allow config screen updates
We may receive configuration (or sysinfo) data after the configuration
screen has been displayed. Implement config_screen_update and redraw the
widgetset when new config data arrives.
Jeremy Kerr [Thu, 17 Oct 2013 05:52:42 +0000 (13:52 +0800)]
ui/ncurses: Add sysinfo screen
Add a simple screen for displaying the struct system_info. We add this
to the main menu as a selectable option, and separate it from the boot
option list with an unselectable blank entry.
Jeremy Kerr [Thu, 17 Oct 2013 04:03:51 +0000 (12:03 +0800)]
ui/common: Don't talloc_free sysinfo and status explicitly
Currently, we talloc_free() the sysinfo and status messages in the
discover client, right after performing the ui's callback.
However, the client may wish to keep a reference to this information
beyond the callback invocation. This change introduces a per-message
talloc context, which these structures are allocated under. This allows
the callbacks to talloc_steal() anything they wish to keep a reference
to.
Neelesh Gupta [Mon, 28 Oct 2013 07:16:12 +0000 (12:46 +0530)]
test/parser: Add new test cases to pxe parser
Adding new cases to the pxe parser code of having conffile file without
complete URL and determining conffile names using mac and ip addresses
passed from the udhcpc.
Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Neelesh Gupta [Mon, 28 Oct 2013 07:15:59 +0000 (12:45 +0530)]
test/parser: Update test cases as per new parser requesting conf files
Update the parser test code/cases as per new prototyping of parse()
function which doesn't require buf and len to be passed from the caller,
instead reading the configuration data either embedded or from file to
a parser's known conffile.
Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Neelesh Gupta [Mon, 28 Oct 2013 07:15:21 +0000 (12:45 +0530)]
discover: Change parsers to explicitly request configuration files
Add a new function parser_request_url() to read the data from
configuration files present remotely. We deprecate
iterate_parser_files() and download_config() functions along with the
'filenames' and 'method' members of the 'parser' structure so that
individual parsers would now require to request the configuration files
data from the parser code and doesn't necessarily export the list of
configuration files.
Add the support to handle incoming DHCP event, done by passing all the
relevant environment variables of the udhcpc to the discover code.
Also, update the pxe parser code to populate the list of configuration
file names as per PXELINUX convention of fallback names using mac and ip
addresses of the booting machine.
Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Fri, 1 Nov 2013 02:33:02 +0000 (10:33 +0800)]
lib/log: Always flush after writing logs
We're currently seeing empty log files from the discover server. Rather
than only flishing if the server was compiled with debugging enabled,
always perform the fflush.