summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown2013-12-05 00:36:53 +0100
committerMichael Brown2013-12-05 01:41:49 +0100
commit60c4e62e5dc56a451958456c7c013b161e53c9b9 (patch)
tree53057c45e2a9728014afab72ed9d7128a0765a7f /src
parent[settings] Allow for IPv6 setting types in non-IPv6 builds (diff)
downloadipxe-60c4e62e5dc56a451958456c7c013b161e53c9b9.tar.gz
ipxe-60c4e62e5dc56a451958456c7c013b161e53c9b9.tar.xz
ipxe-60c4e62e5dc56a451958456c7c013b161e53c9b9.zip
[settings] Add fetch_ipv6_setting()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r--src/core/settings.c38
-rw-r--r--src/include/ipxe/settings.h7
2 files changed, 45 insertions, 0 deletions
diff --git a/src/core/settings.c b/src/core/settings.c
index 9b4087e8b..1269c9a30 100644
--- a/src/core/settings.c
+++ b/src/core/settings.c
@@ -878,6 +878,44 @@ int fetch_ipv4_setting ( struct settings *settings,
}
/**
+ * Fetch value of IPv6 address setting
+ *
+ * @v settings Settings block, or NULL to search all blocks
+ * @v setting Setting to fetch
+ * @v inp IPv6 addresses to fill in
+ * @v count Maximum number of IPv6 addresses
+ * @ret len Length of setting, or negative error
+ */
+int fetch_ipv6_array_setting ( struct settings *settings,
+ const struct setting *setting,
+ struct in6_addr *inp, unsigned int count ) {
+ int len;
+
+ len = fetch_raw_setting ( settings, setting, inp,
+ ( sizeof ( *inp ) * count ) );
+ if ( len < 0 )
+ return len;
+ if ( ( len % sizeof ( *inp ) ) != 0 )
+ return -ERANGE;
+ return len;
+}
+
+/**
+ * Fetch value of IPv6 address setting
+ *
+ * @v settings Settings block, or NULL to search all blocks
+ * @v setting Setting to fetch
+ * @v inp IPv6 address to fill in
+ * @ret len Length of setting, or negative error
+ */
+int fetch_ipv6_setting ( struct settings *settings,
+ const struct setting *setting,
+ struct in6_addr *inp ) {
+
+ return fetch_ipv6_array_setting ( settings, setting, inp, 1 );
+}
+
+/**
* Extract numeric value of setting
*
* @v is_signed Treat value as a signed integer
diff --git a/src/include/ipxe/settings.h b/src/include/ipxe/settings.h
index 3b1328c82..39756f7fd 100644
--- a/src/include/ipxe/settings.h
+++ b/src/include/ipxe/settings.h
@@ -16,6 +16,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
struct settings;
struct in_addr;
+struct in6_addr;
union uuid;
/** A setting */
@@ -341,6 +342,12 @@ extern int fetch_ipv4_array_setting ( struct settings *settings,
extern int fetch_ipv4_setting ( struct settings *settings,
const struct setting *setting,
struct in_addr *inp );
+extern int fetch_ipv6_array_setting ( struct settings *settings,
+ const struct setting *setting,
+ struct in6_addr *inp, unsigned int count);
+extern int fetch_ipv6_setting ( struct settings *settings,
+ const struct setting *setting,
+ struct in6_addr *inp );
extern int fetch_int_setting ( struct settings *settings,
const struct setting *setting, long *value );
extern int fetch_uint_setting ( struct settings *settings,