diff options
Diffstat (limited to 'src/core/settings.c')
| -rw-r--r-- | src/core/settings.c | 38 |
1 files changed, 38 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 |
