summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-ipv4ll.c
diff options
context:
space:
mode:
authorUmut Tezduyar Lindskog <umut.tezduyar@axis.com>2014-04-27 21:58:26 +0200
committerTom Gundersen <teg@jklm.no>2014-04-27 23:39:13 +0200
commitd9bf4f8c6c47b8620ffa1a056208eb15118b78d5 (patch)
tree3d2504b2ec9cc9b3ff69f56ca4d79cdf94acba8c /src/libsystemd-network/sd-ipv4ll.c
parentd96e629fd7a29323ab19917d5afeb05adc62b373 (diff)
libnetworkd: add link local tests
- Also only allow positive ifindex on both dhcp and ipv4ll [tomegun: the kernel always sets a positive ifindex, but some APIs accept ifindex=0 with various meanings, so we should protect against accidentally passing ifindex=0 along.]
Diffstat (limited to 'src/libsystemd-network/sd-ipv4ll.c')
-rw-r--r--src/libsystemd-network/sd-ipv4ll.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libsystemd-network/sd-ipv4ll.c b/src/libsystemd-network/sd-ipv4ll.c
index 72289b2baf..fd39c12eb2 100644
--- a/src/libsystemd-network/sd-ipv4ll.c
+++ b/src/libsystemd-network/sd-ipv4ll.c
@@ -382,7 +382,7 @@ static int ipv4ll_receive_message(sd_event_source *s, int fd,
int sd_ipv4ll_set_index(sd_ipv4ll *ll, int interface_index) {
assert_return(ll, -EINVAL);
- assert_return(interface_index >= -1, -EINVAL);
+ assert_return(interface_index > 0, -EINVAL);
assert_return(IN_SET(ll->state, IPV4LL_STATE_INIT,
IPV4LL_STATE_STOPPED), -EBUSY);
@@ -469,10 +469,13 @@ int sd_ipv4ll_get_address(sd_ipv4ll *ll, struct in_addr *address){
}
int sd_ipv4ll_set_address_seed (sd_ipv4ll *ll, uint8_t seed[8]) {
- unsigned int entropy = *seed;
+ unsigned int entropy;
int r;
assert_return(ll, -EINVAL);
+ assert_return(seed, -EINVAL);
+
+ entropy = *seed;
free(ll->random_data);
free(ll->random_data_state);