Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
74010aa0
Commit
74010aa0
authored
Jun 23, 2013
by
Erich Hoover
Committed by
Alexandre Julliard
Jun 25, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Fix interface-bound filter to accept locally generated targeted packets.
parent
c66d94bf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
socket.c
dlls/ws2_32/socket.c
+12
-1
No files found.
dlls/ws2_32/socket.c
View file @
74010aa0
...
...
@@ -178,6 +178,8 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
struct
interface_filter
{
struct
sock_filter
iface_memaddr
;
struct
sock_filter
iface_rule
;
struct
sock_filter
ip_memaddr
;
struct
sock_filter
ip_rule
;
struct
sock_filter
return_keep
;
struct
sock_filter
return_dump
;
};
...
...
@@ -187,9 +189,17 @@ struct interface_filter {
# define FILTER_JUMP_KEEP(here) (u_char)(offsetof(struct interface_filter, return_keep) \
-offsetof(struct interface_filter, here)-sizeof(struct sock_filter)) \
/sizeof(struct sock_filter)
# define FILTER_JUMP_NEXT() (u_char)(0)
# define SKF_NET_DESTIP 16
/* offset in the network header to the destination IP */
static
struct
interface_filter
generic_interface_filter
=
{
/* This filter rule allows incoming packets on the specified interface, which works for all
* remotely generated packets and for locally generated broadcast packets. */
BPF_STMT
(
BPF_LD
+
BPF_W
+
BPF_ABS
,
SKF_AD_OFF
+
SKF_AD_IFINDEX
),
BPF_JUMP
(
BPF_JMP
+
BPF_JEQ
+
BPF_K
,
0xdeadbeef
,
FILTER_JUMP_KEEP
(
iface_rule
),
FILTER_JUMP_DUMP
(
iface_rule
)),
BPF_JUMP
(
BPF_JMP
+
BPF_JEQ
+
BPF_K
,
0xdeadbeef
,
FILTER_JUMP_KEEP
(
iface_rule
),
FILTER_JUMP_NEXT
()),
/* This rule allows locally generated packets targeted at the specific IP address of the chosen
* adapter (local packets not destined for the broadcast address do not have IFINDEX set) */
BPF_STMT
(
BPF_LD
+
BPF_W
+
BPF_ABS
,
SKF_NET_OFF
+
SKF_NET_DESTIP
),
BPF_JUMP
(
BPF_JMP
+
BPF_JEQ
+
BPF_K
,
0xdeadbeef
,
FILTER_JUMP_KEEP
(
ip_rule
),
FILTER_JUMP_DUMP
(
ip_rule
)),
BPF_STMT
(
BPF_RET
+
BPF_K
,
(
u_int
)
-
1
),
/* keep packet */
BPF_STMT
(
BPF_RET
+
BPF_K
,
0
)
/* dump packet */
};
...
...
@@ -2191,6 +2201,7 @@ static BOOL interface_bind( SOCKET s, int fd, struct sockaddr *addr )
goto
cleanup
;
/* Failed to suggest egress interface */
specific_interface_filter
=
generic_interface_filter
;
specific_interface_filter
.
iface_rule
.
k
=
adapter
->
Index
;
specific_interface_filter
.
ip_rule
.
k
=
htonl
(
adapter_addr
);
filter_prog
.
len
=
sizeof
(
generic_interface_filter
)
/
sizeof
(
struct
sock_filter
);
filter_prog
.
filter
=
(
struct
sock_filter
*
)
&
specific_interface_filter
;
if
(
setsockopt
(
fd
,
SOL_SOCKET
,
SO_ATTACH_FILTER
,
&
filter_prog
,
sizeof
(
filter_prog
))
!=
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment