Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
labs
BIRD Internet Routing Daemon
Commits
9c89560e
Commit
9c89560e
authored
Feb 22, 2015
by
Ondřej Zajíček
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use IP_PORTRANGE_HIGH for BFD where available
parent
6cf72d7a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
lib/socket.h
lib/socket.h
+1
-0
proto/bfd/packets.c
proto/bfd/packets.c
+1
-1
sysdep/unix/io.c
sysdep/unix/io.c
+11
-5
No files found.
lib/socket.h
View file @
9c89560e
...
...
@@ -103,6 +103,7 @@ extern int sk_priority_control; /* Suggested priority for control traffic, shou
#define SKF_LADDR_RX 0x04
/* Report local address for RX packets */
#define SKF_TTL_RX 0x08
/* Report TTL / Hop Limit for RX packets */
#define SKF_BIND 0x10
/* Bind datagram socket to given source address */
#define SKF_HIGH_PORT 0x20
/* Choose port from high range if possible */
#define SKF_THREAD 0x100
/* Socked used in thread, Do not add to main loop */
#define SKF_TRUNCATED 0x200
/* Received packet was truncated, set by IO layer */
...
...
proto/bfd/packets.c
View file @
9c89560e
...
...
@@ -231,7 +231,7 @@ bfd_open_tx_sk(struct bfd_proto *p, ip_addr local, struct iface *ifa)
sk
->
tos
=
IP_PREC_INTERNET_CONTROL
;
sk
->
priority
=
sk_priority_control
;
sk
->
ttl
=
ifa
?
255
:
-
1
;
sk
->
flags
=
SKF_THREAD
|
SKF_BIND
;
sk
->
flags
=
SKF_THREAD
|
SKF_BIND
|
SKF_HIGH_PORT
;
#ifdef IPV6
sk
->
flags
|=
SKF_V6ONLY
;
...
...
sysdep/unix/io.c
View file @
9c89560e
...
...
@@ -1305,7 +1305,7 @@ sk_passive_connected(sock *s, int type)
log
(
L_ERR
"SOCK: Incoming connection: %s%#m"
,
t
->
err
);
/* FIXME: handle it better in rfree() */
close
(
t
->
fd
);
close
(
t
->
fd
);
t
->
fd
=
-
1
;
rfree
(
t
);
return
1
;
...
...
@@ -1348,7 +1348,7 @@ sk_open(sock *s)
bind_addr
=
s
->
saddr
;
do_bind
=
bind_port
||
ipa_nonzero
(
bind_addr
);
break
;
case
SK_UDP
:
fd
=
socket
(
af
,
SOCK_DGRAM
,
IPPROTO_UDP
);
bind_port
=
s
->
sport
;
...
...
@@ -1399,6 +1399,14 @@ sk_open(sock *s)
}
#endif
}
#ifdef IP_PORTRANGE
else
if
(
s
->
flags
&
SKF_HIGH_PORT
)
{
int
range
=
IP_PORTRANGE_HIGH
;
if
(
setsockopt
(
fd
,
IPPROTO_IP
,
IP_PORTRANGE
,
&
range
,
sizeof
(
range
))
<
0
)
log
(
L_WARN
"Socket error: %s%#m"
,
"IP_PORTRANGE"
);
}
#endif
sockaddr_fill
(
&
sa
,
af
,
bind_addr
,
s
->
iface
,
bind_port
);
if
(
bind
(
fd
,
&
sa
.
sa
,
SA_LEN
(
sa
))
<
0
)
...
...
@@ -1661,7 +1669,7 @@ sk_rx_ready(sock *s)
redo:
rv
=
select
(
s
->
fd
+
1
,
&
rd
,
&
wr
,
NULL
,
&
timo
);
if
((
rv
<
0
)
&&
(
errno
==
EINTR
||
errno
==
EAGAIN
))
goto
redo
;
...
...
@@ -2026,5 +2034,3 @@ test_old_bird(char *path)
die
(
"I found another BIRD running."
);
close
(
fd
);
}
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