]> git.ozlabs.org Git - petitboot/log
petitboot
10 years agotest/parser: Check for full URLs in parser tests
Jeremy Kerr [Fri, 17 Jan 2014 08:36:41 +0000 (16:36 +0800)]
test/parser: Check for full URLs in parser tests

At present, we only match the 'file' portion of a URL in the parser
tests, so we "serve" a file if just the filename (but not the scheme,
hostname or path) matches the file we set with test_read_conf_embedded.

This change introduces test_read_conf_embedded_url, which we can use to
specify a full URL. In this case, the fake parser_request_file matches
the entire URL before returning the file data.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover: Don't rely on ctx->conf_url side-effect in user_event_parse_conf_url
Jeremy Kerr [Fri, 17 Jan 2014 06:50:54 +0000 (14:50 +0800)]
discover: Don't rely on ctx->conf_url side-effect in user_event_parse_conf_url

Currently, user_event_parse_conf_url sets dc->conf_url if it detects we
have a full URL (rather than a base URL). This is a little too subtle,
so replace it with an explicit output parameter.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/grub: Use --id values for default option detection
Ben Stoltz [Wed, 15 Jan 2014 23:10:25 +0000 (15:10 -0800)]
discover/grub: Use --id values for default option detection

Fix Petitboot's grub.cfg parser to handle --id=label argument to
menuentry, and use it (in preference to the option name) when looking
for a default option.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover: Bring down configured interfaces on discover server exit.
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoutils: Add boot hook to set stdout property on DT machines
Jeremy Kerr [Wed, 15 Jan 2014 07:59:27 +0000 (15:59 +0800)]
utils: Add boot hook to set stdout property on DT machines

On machines that use device-tree boot, they'll often set an early
console, defined by the linux,stdout property in the /chosen/ device
tree node.

This hook adds a facility for petitboot to set this, based on an NVRAM
setting.

10 years agodiscover: we need stderr for the BusyBox TFTP type check
Jeremy Kerr [Tue, 14 Jan 2014 07:58:31 +0000 (15:58 +0800)]
discover: we need stderr for the BusyBox TFTP type check

Busybox tftp doesn't support -V, so prints an error to stderr. We'll
only see the Busybox identifier if we capture stderr too.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agolib/process: Add add_stderr flag to process module
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agotest/parser: Add yaboot leftovers test
Jeremy Kerr [Tue, 14 Jan 2014 03:15:03 +0000 (11:15 +0800)]
test/parser: Add yaboot leftovers test

Add a test to ensure that boot option parameters don't leak into later
options.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/yaboot: Remove known_names list
Jeremy Kerr [Tue, 14 Jan 2014 03:04:54 +0000 (11:04 +0800)]
discover/yaboot: Remove known_names list

The known_names list only duplicates the arg matching we do in the body
of the parser, and so introduces a problem when the array becomes out of
sync.

We drop the priority of the "unknown name" messages to pb_debug, as this
isn't really imporant unless we're debugging.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/yaboot: Clear globals_done when we see an image definition
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/udev: Set device type for optical media correctly
Jeremy Kerr [Mon, 13 Jan 2014 08:06:01 +0000 (16:06 +0800)]
discover/udev: Set device type for optical media correctly

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoconfig/powerpc: Always call update_network_config
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses/nc-config: Add validation for network settings
Jeremy Kerr [Wed, 18 Dec 2013 05:06:36 +0000 (13:06 +0800)]
ui/ncurses/nc-config: Add validation for network settings

Use the new widget validators, plus a bit of whole-form logic, to
implement some basic validation on the config UI.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses/nc-widgets: Add initial textbox validation functions
Jeremy Kerr [Wed, 18 Dec 2013 05:05:01 +0000 (13:05 +0800)]
ui/ncurses/nc-widgets: Add initial textbox validation functions

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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses/nc-config: expand mask field
Jeremy Kerr [Wed, 18 Dec 2013 02:31:10 +0000 (10:31 +0800)]
ui/ncurses/nc-config: expand mask field

This makes it obvious if there's more than two characters in the field.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoconfigure: Use AC_GNU_SOURCE
Jeremy Kerr [Mon, 16 Dec 2013 08:21:50 +0000 (16:21 +0800)]
configure: Use AC_GNU_SOURCE

Rather than #defining _GNU_SOURCE in our .c files, we can define this
from config.h instead.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Add link status to system info & system config screens
Jeremy Kerr [Mon, 16 Dec 2013 05:20:01 +0000 (13:20 +0800)]
ui/ncurses: Add link status to system info & system config screens

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agolib/util: Avoid sprintf in mac_str
Jeremy Kerr [Mon, 16 Dec 2013 03:21:22 +0000 (11:21 +0800)]
lib/util: Avoid sprintf in mac_str

The conversion is simple, no need for sprintf.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agolib/util: Move mac_buf from nc code to util library
Jeremy Kerr [Mon, 16 Dec 2013 03:12:03 +0000 (11:12 +0800)]
lib/util: Move mac_buf from nc code to util library

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agosysinfo: Add interface link status to sysinfo data
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agotest/lib: Add parent stdout test
Jeremy Kerr [Mon, 16 Dec 2013 07:16:36 +0000 (15:16 +0800)]
test/lib: Add parent stdout test

Looks like we missed adding a test source file.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/yaboot: Fix assertion failure on empty yaboot files
Jeremy Kerr [Tue, 10 Dec 2013 00:54:17 +0000 (08:54 +0800)]
discover/yaboot: Fix assertion failure on empty yaboot files

yaboot configuration files with no option will cause an assertion
failure (or segfault), as we unconditionally call yaboot_finish().

Check for the presence of an option in yaboot_finish() instead of
asserting.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/boot: Copy local paths before running boot hooks
Jeremy Kerr [Thu, 5 Dec 2013 06:54:13 +0000 (14:54 +0800)]
discover/boot: Copy local paths before running boot hooks

We're seeing a crash when boot hooks are specifying new resources, as
boot_hook_update_param will write to a NULL struct load_url_result.

Instead of writing the updated values to the struct, copy the local
parts of the result to a separate string, which the boot hooks are free
to update.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/boot: Fix condition for updating boot params
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/udev: Use UUIDs for multipath check
Jeremy Kerr [Wed, 4 Dec 2013 06:49:40 +0000 (14:49 +0800)]
discover/udev: Use UUIDs for multipath check

Partitions will share a serial number.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses/boot-editor: Fix (null) when non-device resources are shown
Jeremy Kerr [Tue, 3 Dec 2013 11:28:10 +0000 (19:28 +0800)]
ui/ncurses/boot-editor: Fix (null) when non-device resources are shown

We're seeing the following in the boot editor:

 image:  (null)ftp://...

the (null) is due to the sep in conditional_prefix, which should be
blank, not NULL.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/grub2: Fixes for bison 3.x
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover: Fix CDROM handling
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Add key debug
Jeremy Kerr [Mon, 2 Dec 2013 08:03:54 +0000 (16:03 +0800)]
ui/ncurses: Add key debug

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/device-handler: Ensure we free unresolved boot options on remove
Jeremy Kerr [Mon, 2 Dec 2013 03:20:04 +0000 (11:20 +0800)]
discover/device-handler: Ensure we free unresolved boot options on remove

When we remove a device, some options may still be unresolved, and so
won't be deallocated through freeing the device.

This chagne explicitly removes & frees any currently-unresolved options
for this device.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/udev: copy dev->device path from udev devnode
Jeremy Kerr [Fri, 29 Nov 2013 05:44:54 +0000 (13:44 +0800)]
discover/udev: copy dev->device path from udev devnode

We're seeing a use-after-free, as the udev path is freed before the
discover device.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/grub2: Populate $prefix from config file location
Jeremy Kerr [Wed, 27 Nov 2013 11:51:49 +0000 (19:51 +0800)]
discover/grub2: Populate $prefix from config file location

Rather than always using the default prefix, we should determine it from
the location of the grub2 config file.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agotest/parser/grub2: Fix inconsistent conf/env paths
Jeremy Kerr [Wed, 27 Nov 2013 12:00:11 +0000 (20:00 +0800)]
test/parser/grub2: Fix inconsistent conf/env paths

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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/grub2: Use parser for a single parse
Jeremy Kerr [Wed, 27 Nov 2013 11:47:37 +0000 (19:47 +0800)]
discover/grub2: Use parser for a single parse

Currently, we re-use a grub2 parser for different filenames, and will
create one even if we find no matching files.

This change only creates a parser if parser_request_file succeeds, and
free() (and exits the parse) immediately after.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/grub2: Fix free in load_env command
Jeremy Kerr [Wed, 27 Nov 2013 11:43:25 +0000 (19:43 +0800)]
discover/grub2: Fix free in load_env command

We only need to free the buf if parser_request_file returned success.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/grub2: Fix indentation error
Jeremy Kerr [Wed, 27 Nov 2013 10:58:52 +0000 (18:58 +0800)]
discover/grub2: Fix indentation error

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/grub2: Add support for -s and -f commands
Jeremy Kerr [Wed, 27 Nov 2013 10:56:16 +0000 (18:56 +0800)]
discover/grub2: Add support for -s and -f commands

Implement -s and -f checks for grub, and test with the standard GRUB2
saved_default config.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover/network: In static config mode, only configure defined interfaces
Jeremy Kerr [Wed, 27 Nov 2013 10:52:37 +0000 (18:52 +0800)]
discover/network: In static config mode, only configure defined interfaces

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agolib/pb-config/powerpc-nvram: Fix format of dns config
Jeremy Kerr [Tue, 26 Nov 2013 05:29:04 +0000 (13:29 +0800)]
lib/pb-config/powerpc-nvram: Fix format of dns config

It should be dns,<server> not dns=<server>

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses/nc-widgets: Unify select key
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Redraw entire screen with ctrl+L
Jeremy Kerr [Tue, 19 Nov 2013 23:03:42 +0000 (10:03 +1100)]
ui/ncurses: Redraw entire screen with ctrl+L

Use wrefresh(curscr) to clean and repaint the entire screen.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Ensure boot editor window is properly painted
Jeremy Kerr [Tue, 19 Nov 2013 07:03:40 +0000 (18:03 +1100)]
ui/ncurses: Ensure boot editor window is properly painted

We're not currently drawing the window title correctly; we need to draw
the main_ncw for this to hit the terminal.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Fix use-after-free when exiting boot option editor
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Allow boot editor sysinfo updates
Jeremy Kerr [Tue, 19 Nov 2013 05:08:35 +0000 (16:08 +1100)]
ui/ncurses: Allow boot editor sysinfo updates

We may start a boot editor (via 'New') before we have the sysinfo. To
allow this, we redraw the device select.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Add widgetset_set_window
Jeremy Kerr [Wed, 20 Nov 2013 03:18:35 +0000 (14:18 +1100)]
ui/ncurses: Add widgetset_set_window

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Add widget_select_drop_options
Jeremy Kerr [Wed, 20 Nov 2013 03:17:31 +0000 (14:17 +1100)]
ui/ncurses: Add widget_select_drop_options

We want to be able to re-set the options in a select widget.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Implement intra-field scrolling
Jeremy Kerr [Tue, 19 Nov 2013 03:20:30 +0000 (14:20 +1100)]
ui/ncurses: Implement intra-field scrolling

Now that we can calculate the focus within a field, ensure that the
focussed-element remains scrolled.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses/widgets: Add widget focus offset query
Jeremy Kerr [Tue, 19 Nov 2013 03:18:28 +0000 (14:18 +1100)]
ui/ncurses/widgets: Add widget focus offset query

When we have widgets that are larger than the screen, we'd like to
scroll to the currently-focussed component of that widget.

This change introduces a widget_focus_y function, which returns the y
offset of the field's focus.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Draw boot editor into a scrollable pad
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Make boot editor paths relative to device
Jeremy Kerr [Sun, 17 Nov 2013 09:54:46 +0000 (20:54 +1100)]
ui/ncurses: Make boot editor paths relative to device

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Add device selector to boot editor
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses/widgets: Add n_options check to widget_select_get_value
Jeremy Kerr [Sun, 17 Nov 2013 08:35:49 +0000 (19:35 +1100)]
ui/ncurses/widgets: Add n_options check to widget_select_get_value

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Split boot editor layout
Jeremy Kerr [Sun, 17 Nov 2013 05:30:47 +0000 (16:30 +1100)]
ui/ncurses: Split boot editor layout

We want to make the boot editor dynamic later, so split the widget
layout from the widget creation.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Make boot editor API consistent with config & sysinfo screens
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: remove boot_editor_attr_field
Jeremy Kerr [Fri, 15 Nov 2013 07:34:07 +0000 (18:34 +1100)]
ui/ncurses: remove boot_editor_attr_field

The widgetset code handles these attributes now.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Add block devices to system info screen
Jeremy Kerr [Fri, 15 Nov 2013 04:56:39 +0000 (15:56 +1100)]
ui/ncurses: Add block devices to system info screen

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover: populate sysinfo with block devices
Jeremy Kerr [Fri, 15 Nov 2013 04:23:54 +0000 (15:23 +1100)]
discover: populate sysinfo with block devices

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoprotocol: Add block device information to system info
Jeremy Kerr [Fri, 15 Nov 2013 04:13:41 +0000 (15:13 +1100)]
protocol: Add block device information to system info

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover: Use pxeconffile for udhcpc option name
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:

  http://git.busybox.net/busybox/commit/?id=d3092c99ae90f

This change uses the new name, and explicilty requests this option.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoutils/pb-console: Exit after running getty in detached state
Jeremy Kerr [Fri, 22 Nov 2013 01:36:58 +0000 (09:36 +0800)]
utils/pb-console: Exit after running getty in detached state

... otherwise we'll try and bring the UI up on the current tty too.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Fix pad size check
Jeremy Kerr [Tue, 19 Nov 2013 02:23:10 +0000 (13:23 +1100)]
ui/ncurses: Fix pad size check

We need the y-coord, not x.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Don't mess with prog_mode in cui_boot
Jeremy Kerr [Fri, 15 Nov 2013 01:57:13 +0000 (12:57 +1100)]
ui/ncurses: Don't mess with prog_mode in cui_boot

The discover_client_boot call is asynchronous, so setting and resetting
prog_mode doesn't gain us anything.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoautomake: Fixups for maintainer-clean
Geoff Levand [Mon, 18 Nov 2013 22:58:48 +0000 (14:58 -0800)]
automake: Fixups for maintainer-clean

Signed-off-by: Geoff Levand <geoff@infradead.org>
10 years agolib/system: Don't leak in pb_mkdir_recursive
Jeremy Kerr [Thu, 14 Nov 2013 05:18:59 +0000 (16:18 +1100)]
lib/system: Don't leak in pb_mkdir_recursive

If the mkdir fails, we'll exit without freeing str.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover: Use mkstemp rather than tempnam
Jeremy Kerr [Thu, 14 Nov 2013 03:54:34 +0000 (14:54 +1100)]
discover: Use mkstemp rather than tempnam

We're getting warnings from some compilers about tempnam being unsafe.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoutils/pb-console: reset after UI exit
Jeremy Kerr [Fri, 25 Oct 2013 01:58:00 +0000 (09:58 +0800)]
utils/pb-console: reset after UI exit

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses/menu: Allow space to select menu items
Jeremy Kerr [Fri, 8 Nov 2013 02:03:30 +0000 (10:03 +0800)]
ui/ncurses/menu: Allow space to select menu items

To keep consistent with buttons, which also accept space.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Add descriptive text for configuration editor
Jeremy Kerr [Wed, 6 Nov 2013 06:05:57 +0000 (14:05 +0800)]
ui/ncurses: Add descriptive text for configuration editor

This change adds:
 - 'seconds' to the timeout text entry
 - examples to the ip/mask, gateway and DNS text entries

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses/nc-config: Draw config form into a scrollable pad
Jeremy Kerr [Fri, 25 Oct 2013 08:06:50 +0000 (16:06 +0800)]
ui/ncurses/nc-config: Draw config form into a scrollable pad

Currently, when the config form is larger than the screen size, the form
fails to draw.

This change draws the config screen onto a pad instead, which we can
scroll.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agonui/ncurses: Allow config screen updates
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Add help for the DNS option
Jeremy Kerr [Thu, 24 Oct 2013 08:57:38 +0000 (16:57 +0800)]
ui/ncurses: Add help for the DNS option

It's not obvious why it's there when we're configuring DHCP.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Populate configuration interface with current defaults
Jeremy Kerr [Thu, 24 Oct 2013 08:51:44 +0000 (16:51 +0800)]
ui/ncurses: Populate configuration interface with current defaults

Sets the default values of configuration widgets to the values found in
t he current config.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Parse configuration form & send to server
Jeremy Kerr [Thu, 24 Oct 2013 06:02:49 +0000 (14:02 +0800)]
ui/ncurses: Parse configuration form & send to server

This change implements the configuration save action, when the user
submits the nc-config form.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Add network configuration
Jeremy Kerr [Thu, 24 Oct 2013 03:05:34 +0000 (11:05 +0800)]
ui/ncurses: Add network configuration

Add network configuration parameters. This requires a somewhat-dynamic
layout, as the fields shown depend on earlier configuration.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Add basic config editor
Jeremy Kerr [Mon, 21 Oct 2013 10:59:12 +0000 (18:59 +0800)]
ui/ncurses: Add basic config editor

This change adds a simple configuration editor to the ncurses UI.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Receive config messages
Jeremy Kerr [Fri, 18 Oct 2013 03:45:03 +0000 (11:45 +0800)]
ui/ncurses: Receive config messages

We just store the config in the cui for now.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Use nc-widgets for boot editor
Jeremy Kerr [Mon, 21 Oct 2013 10:55:06 +0000 (18:55 +0800)]
ui/ncurses: Use nc-widgets for boot editor

Now that we have a simple widget set available, use this for the boot
editor.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Add simple ncurses form widget set
Jeremy Kerr [Mon, 21 Oct 2013 06:09:43 +0000 (14:09 +0800)]
ui/ncurses: Add simple ncurses form widget set

We're doing a lot of the same stuff with forms, and we'll to implement a
lot of fields with the upcoming configuration interface.

This change introduces a simple ncurses widget set.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Add sysinfo screen
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses/scr: Add definition for frame offset
Jeremy Kerr [Thu, 17 Oct 2013 05:48:35 +0000 (13:48 +0800)]
ui/ncurses/scr: Add definition for frame offset

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: nc-menu.h needs assert.h
Jeremy Kerr [Thu, 17 Oct 2013 05:47:24 +0000 (13:47 +0800)]
ui/ncurses: nc-menu.h needs assert.h

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/common: Don't talloc_free sysinfo and status explicitly
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.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Add nc_scr_{un,}post()
Jeremy Kerr [Wed, 16 Oct 2013 03:30:29 +0000 (11:30 +0800)]
ui/ncurses: Add nc_scr_{un,}post()

We may have nc_scrs that aren't interested in post/unpost information,
so create helper functions that allow a NULL callback.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoui/ncurses: Move general nc init code to cui module
Jeremy Kerr [Tue, 15 Oct 2013 07:51:49 +0000 (15:51 +0800)]
ui/ncurses: Move general nc init code to cui module

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover: Handle incoming configuration messages
Jeremy Kerr [Thu, 24 Oct 2013 06:43:05 +0000 (14:43 +0800)]
discover: Handle incoming configuration messages

When the client sends us a PB_PROTOCOL_ACTION_CONFIG message, we want to
update the current config.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoconfig: Implement config messages
Jeremy Kerr [Fri, 18 Oct 2013 02:31:03 +0000 (10:31 +0800)]
config: Implement config messages

On client connect, send a PB_PROTOCOL_ACTION_CONFIG message.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agolib/pb-protocol: Add serialise & deserialise for struct config
Jeremy Kerr [Fri, 18 Oct 2013 02:21:50 +0000 (10:21 +0800)]
lib/pb-protocol: Add serialise & deserialise for struct config

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agolib/types: use unsigned int for interface, dns and prio counts
Jeremy Kerr [Fri, 18 Oct 2013 02:07:06 +0000 (10:07 +0800)]
lib/types: use unsigned int for interface, dns and prio counts

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agolib: Move config structure defitinitions to types.h
Jeremy Kerr [Fri, 18 Oct 2013 02:06:02 +0000 (10:06 +0800)]
lib: Move config structure defitinitions to types.h

We don't want to require the lib/pb-config interface in the UIs, just
the structure defintions. This change moves them to the common types
header.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agolib/pb-config: Implement save method for test storage
Jeremy Kerr [Fri, 18 Oct 2013 00:15:19 +0000 (08:15 +0800)]
lib/pb-config: Implement save method for test storage

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agolib/pb-config: Implement save method for powerpc nvram strorage
Jeremy Kerr [Fri, 18 Oct 2013 00:15:19 +0000 (08:15 +0800)]
lib/pb-config: Implement save method for powerpc nvram strorage

Write values back to nvram.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agolib/pb-config: Implement config_set
Jeremy Kerr [Fri, 18 Oct 2013 00:13:53 +0000 (08:13 +0800)]
lib/pb-config: Implement config_set

This change adds config_set, to allow the configuration to be updated,
but calling the storage backend's save() method.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agolib/util: Add build_assert()
Jeremy Kerr [Mon, 21 Oct 2013 06:00:14 +0000 (14:00 +0800)]
lib/util: Add build_assert()

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agolib/util: Implement min & max macros
Jeremy Kerr [Mon, 21 Oct 2013 04:15:20 +0000 (12:15 +0800)]
lib/util: Implement min & max macros

Standard type-safe min & max implementations.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agolib: consolidate util macros in util/util.h
Jeremy Kerr [Mon, 21 Oct 2013 03:03:17 +0000 (11:03 +0800)]
lib: consolidate util macros in util/util.h

This change groups the offsetof, container_of and ARRAY_SIZE macros in a
single header file util/util.h.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodiscover: Fix potentially-uninitialised variables
Jeremy Kerr [Fri, 8 Nov 2013 06:23:32 +0000 (14:23 +0800)]
discover: Fix potentially-uninitialised variables

We've been compiling with --enable-debug; this change fixes some
problems exposed by the optimiser.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agotest/parser: Add local PXE test
Jeremy Kerr [Thu, 7 Nov 2013 05:12:37 +0000 (13:12 +0800)]
test/parser: Add local PXE test

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agotest/parser: Add new test cases to pxe parser
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>
10 years agotest/parser: Update test cases as per new parser requesting conf files
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>
10 years agodiscover: Change parsers to explicitly request configuration files
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>