git: bb8fa2ef83c9 - main - sbin/nos-tun: correct SIOCDIFADDR calls to use ifreq
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 22 Jul 2024 10:02:24 UTC
The branch main has been updated by def:
URL: https://cgit.FreeBSD.org/src/commit/?id=bb8fa2ef83c91d4bd5538f4f445b4100ac141419
commit bb8fa2ef83c91d4bd5538f4f445b4100ac141419
Author: Konrad Witaszczyk <def@FreeBSD.org>
AuthorDate: 2024-06-28 10:28:55 +0000
Commit: Konrad Witaszczyk <def@FreeBSD.org>
CommitDate: 2024-07-22 09:58:37 +0000
sbin/nos-tun: correct SIOCDIFADDR calls to use ifreq
The SIOCDIFADDR ioctl takes an ifreq structure object, not an ifaliasreq
structure object, as its argument.
Reviewed by: brooks, jhb, oshogbo
Approved by: oshogbo (mentor)
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D46017
---
sbin/nos-tun/nos-tun.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/sbin/nos-tun/nos-tun.c b/sbin/nos-tun/nos-tun.c
index f3af62db265b..ca0e33b2509a 100644
--- a/sbin/nos-tun/nos-tun.c
+++ b/sbin/nos-tun/nos-tun.c
@@ -141,7 +141,7 @@ tun_open(char *dev_name, struct sockaddr *ouraddr, char *theiraddr)
* when tunN have no addresses, so - log and ignore it.
*
*/
- if (ioctl(s, SIOCDIFADDR, &ifra) < 0) {
+ if (ioctl(s, SIOCDIFADDR, &ifrq) < 0) {
syslog(LOG_ERR,"SIOCDIFADDR - %m");
}
@@ -220,10 +220,8 @@ Finish(int signum)
/*
* Delete addresses for interface
*/
- bzero(&ifra.ifra_addr, sizeof(ifra.ifra_addr));
- bzero(&ifra.ifra_broadaddr, sizeof(ifra.ifra_addr));
- bzero(&ifra.ifra_mask, sizeof(ifra.ifra_addr));
- if (ioctl(s, SIOCDIFADDR, &ifra) < 0) {
+ bzero(&ifrq.ifr_addr, sizeof(ifrq.ifr_addr));
+ if (ioctl(s, SIOCDIFADDR, &ifrq) < 0) {
syslog(LOG_ERR,"can't delete interface's addresses - %m");
}
closing_fds: