Mercurial > hg > dhcpcd
comparison src/if-linux.c @ 5557:e65d193a1960 draft
Linux: Support wireless IP roaming
This is achieved by checking that the interface is wireless,
IFF_UP and IFF_LOWER_UP are present, but IFF_RUNNING is missing.
This gives exactly the same support as modern NetBSD when carrier
loss is detected, but without the address verifications when the
carrier comes back as that needs to be handled in the kernel.
While IP setup is maintained, other configuration data is discarded.
Note that this should be improved in the future.
Thanks to Boris Krasnovskiy <borkra@gmail.com> for helping with this.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Sat, 12 Dec 2020 13:12:26 +0000 |
| parents | 605f7f9a20c0 |
| children | dd1e6f7adadd |
comparison
equal
deleted
inserted
replaced
| 5556:99bfd2eb77ab | 5557:e65d193a1960 |
|---|---|
| 513 { | 513 { |
| 514 | 514 |
| 515 return ifp->flags & IFF_RUNNING ? LINK_UP : LINK_DOWN; | 515 return ifp->flags & IFF_RUNNING ? LINK_UP : LINK_DOWN; |
| 516 } | 516 } |
| 517 | 517 |
| 518 bool | |
| 519 if_roaming(struct interface *ifp) | |
| 520 { | |
| 521 | |
| 522 #ifdef IFF_LOWER_UP | |
| 523 if (!ifp->wireless || | |
| 524 ifp->flags & IFF_RUNNING || | |
| 525 (ifp->flags & (IFF_UP | IFF_LOWER_UP)) != (IFF_UP | IFF_LOWER_UP)) | |
| 526 return false; | |
| 527 return true; | |
| 528 #else | |
| 529 return false; | |
| 530 #endif | |
| 531 } | |
| 532 | |
| 518 int | 533 int |
| 519 if_getnetlink(struct dhcpcd_ctx *ctx, struct iovec *iov, int fd, int flags, | 534 if_getnetlink(struct dhcpcd_ctx *ctx, struct iovec *iov, int fd, int flags, |
| 520 int (*cb)(struct dhcpcd_ctx *, void *, struct nlmsghdr *), void *cbarg) | 535 int (*cb)(struct dhcpcd_ctx *, void *, struct nlmsghdr *), void *cbarg) |
| 521 { | 536 { |
| 522 struct sockaddr_nl nladdr = { .nl_pid = 0 }; | 537 struct sockaddr_nl nladdr = { .nl_pid = 0 }; |
