mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-21 10:41:46 +01:00
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
This commit is contained in:
parent
5688843dc9
commit
bb8fa2ef83
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user