[PATCH 3/3] iphlpapi: Implement CancelIPChangeNotify.
Hans Leidekker
hans at codeweavers.com
Fri May 10 04:48:08 CDT 2013
On Wed, 2013-05-08 at 15:34 -0600, Erich E. Hoover wrote:
> +#ifdef HAVE_LINUX_NETLINK_H
> +# include <linux/netlink.h>
> +#endif
> +#ifdef HAVE_LINUX_RTNETLINK_H
> +# include <linux/rtnetlink.h>
> +#endif
> +
> +#ifdef NLMSG_OK
> +# define WINE_LINKMON_FAMILY PF_NETLINK
> +# define WINE_LINKMON_TYPE SOCK_RAW
> +# define WINE_LINKMON_PROTO NETLINK_ROUTE
> +# define WINE_LINKMON_ADDRCHANGE(b) (NLMSG_OK((struct nlmsghdr*)b, len) \
> + && (((struct nlmsghdr*)b)->nlmsg_type == RTM_NEWADDR \
> + || ((struct nlmsghdr*)b)->nlmsg_type == RTM_DELADDR))
> +#endif
I don't see the need for these defines. WINE_LINKMON_ADDRCHANGE could be turned
into a function.
> @@ -2043,12 +2100,79 @@ DWORD WINAPI IpRenewAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo)
> * FIXME
> * Stub, returns ERROR_NOT_SUPPORTED.
> */
> -DWORD WINAPI NotifyAddrChange(PHANDLE Handle, LPOVERLAPPED overlapped)
> +DWORD WINAPI NotifyAddrChange(PHANDLE handle, LPOVERLAPPED overlapped)
> {
> - FIXME("(Handle %p, overlapped %p): stub\n", Handle, overlapped);
> - if (Handle) *Handle = INVALID_HANDLE_VALUE;
> - if (overlapped) ((IO_STATUS_BLOCK *) overlapped)->u.Status = STATUS_PENDING;
> - return ERROR_IO_PENDING;
> +#ifdef WINE_LINKMON_FAMILY
> + IO_STATUS_BLOCK *iosb = (IO_STATUS_BLOCK *) overlapped;
> + struct sockaddr_nl addr;
> + NTSTATUS status;
> + int fd = -1;
> + HANDLE h;
> +
> + TRACE("(handle %p, overlapped %p): stub\n", handle, overlapped);
> +
> + h = INVALID_HANDLE_VALUE;
> + SERVER_START_REQ( create_socket )
Using a generic socket object might work I guess. The cost will be a new socket
per caller whereas in theory we could serve all callers with a single socket,
though that would require a dedicated server request. That might be needed anyway,
if this handle somehow turns out to be special.
I know MacOS has a similar socket based mechanism that could probably be handled
in the same way.
More information about the wine-devel
mailing list