ObjFW  Check-in [22fab9e495]

Overview
Comment:OFDDPSocket: Fix removing configuration on NetBSD
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 22fab9e495b0b35f89af303d124a140895a8a93412ea490b7db174a83b05fa94
User & Date: js on 2023-04-16 06:21:42
Other Links: manifest | tags
Context
2023-04-16
13:08
Add NetBSD to GitHub Actions check-in: 1f3034f11c user: js tags: trunk
06:21
OFDDPSocket: Fix removing configuration on NetBSD check-in: 22fab9e495 user: js tags: trunk
2023-04-15
17:30
OFDDPSocket: Add support for configuring AppleTalk check-in: ccb53db0d8 user: js tags: trunk
Changes

Modified src/OFDDPSocket.m from [ac9c1835dc] to [55ed0932ea].

229
230
231
232
233
234
235





236
237
238





239
240
241
242
243
244
245
# else
	if ((sock = socket(AF_APPLETALK, SOCK_DGRAM, 0)) < 0)
# endif
		@throw [OFSetOptionFailedException
		    exceptionWithObject: nil
				  errNo: OFSocketErrNo()];






	memset(&request, 0, sizeof(request));
	strncpy(request.ifr_name, interfaceName.UTF8String, IFNAMSIZ - 1);
	request.ifr_addr.sa_family = AF_APPLETALK;






	if (ioctl(sock, SIOCDIFADDR, &request) != 0)
		@throw [OFSetOptionFailedException
		    exceptionWithObject: nil
				  errNo: OFSocketErrNo()];
}
#endif







>
>
>
>
>


|
>
>
>
>
>







229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# else
	if ((sock = socket(AF_APPLETALK, SOCK_DGRAM, 0)) < 0)
# endif
		@throw [OFSetOptionFailedException
		    exceptionWithObject: nil
				  errNo: OFSocketErrNo()];

	/*
	 * NetBSD requires the address to be removed, while Linux ignores the
	 * address entirely.
	 */

	memset(&request, 0, sizeof(request));
	strncpy(request.ifr_name, interfaceName.UTF8String, IFNAMSIZ - 1);

	if (ioctl(sock, SIOCGIFADDR, &request) != 0)
		if (errno != EADDRNOTAVAIL)
			@throw [OFSetOptionFailedException
			    exceptionWithObject: nil
					  errNo: OFSocketErrNo()];

	if (ioctl(sock, SIOCDIFADDR, &request) != 0)
		@throw [OFSetOptionFailedException
		    exceptionWithObject: nil
				  errNo: OFSocketErrNo()];
}
#endif