Skip to content

Commit 73ac184

Browse files
committed
INET: Fix corruption of IPv4 address flags when renewing
What a mistaka to maka!
1 parent 2c8dc9e commit 73ac184

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

src/ipv4.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ ipv4_addaddr(struct interface *ifp, const struct in_addr *addr,
654654
#endif
655655
ia->flags = IPV4_AF_NEW;
656656
} else
657-
ia->flags |= ~IPV4_AF_NEW;
657+
ia->flags &= ~IPV4_AF_NEW;
658658

659659
ia->mask = *mask;
660660
ia->brd = *bcast;
@@ -952,15 +952,13 @@ ipv4_free(struct interface *ifp)
952952
struct ipv4_state *state;
953953
struct ipv4_addr *ia;
954954

955-
if (ifp) {
956-
state = IPV4_STATE(ifp);
957-
if (state) {
958-
while ((ia = TAILQ_FIRST(&state->addrs))) {
959-
TAILQ_REMOVE(&state->addrs, ia, next);
960-
free(ia);
961-
}
962-
free(state->buffer);
963-
free(state);
964-
}
955+
if (ifp == NULL || (state = IPV4_STATE(ifp)) == NULL)
956+
return;
957+
958+
while ((ia = TAILQ_FIRST(&state->addrs))) {
959+
TAILQ_REMOVE(&state->addrs, ia, next);
960+
free(ia);
965961
}
962+
free(state->buffer);
963+
free(state);
966964
}

0 commit comments

Comments
 (0)