mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 22:05:19 +00:00
Allow configuring DSCP on controller and manager connections.
The changes allow the user to specify a separate dscp value for the controller connection and the manager connection. The value will take effect on resetting the connections. If no value is specified a default value of 192 is chosen for each of the connections. Feature #10074 Requested-by: Rajiv Ramanathan <rramanathan@nicira.com> Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
This commit is contained in:
@@ -544,10 +544,13 @@ exit:
|
||||
* and stores -1 into '*fdp'.
|
||||
*
|
||||
* If 'sinp' is non-null, then on success the target address is stored into
|
||||
* '*sinp'. */
|
||||
* '*sinp'.
|
||||
*
|
||||
* 'dscp' If not DSCP_INVALID, its value becomes the DSCP bits in the IP
|
||||
* headers for the new connection. */
|
||||
int
|
||||
inet_open_active(int style, const char *target, uint16_t default_port,
|
||||
struct sockaddr_in *sinp, int *fdp)
|
||||
struct sockaddr_in *sinp, int *fdp, uint8_t dscp)
|
||||
{
|
||||
struct sockaddr_in sin;
|
||||
int fd = -1;
|
||||
@@ -571,6 +574,17 @@ inet_open_active(int style, const char *target, uint16_t default_port,
|
||||
goto exit_close;
|
||||
}
|
||||
|
||||
/* The socket options set here ensure that the TOS bits are set during
|
||||
* the connection establishment. If set after connect(), the handshake
|
||||
* SYN frames will be sent with a TOS of 0. */
|
||||
if (dscp != DSCP_INVALID) {
|
||||
if (setsockopt(fd, IPPROTO_IP, IP_TOS, &dscp, sizeof dscp)) {
|
||||
VLOG_ERR("%s: socket: %s", target, strerror(errno));
|
||||
error = errno;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
/* Connect. */
|
||||
error = connect(fd, (struct sockaddr *) &sin, sizeof sin) == 0 ? 0 : errno;
|
||||
if (error == EINPROGRESS) {
|
||||
@@ -663,10 +677,13 @@ exit:
|
||||
* negative errno value.
|
||||
*
|
||||
* If 'sinp' is non-null, then on success the bound address is stored into
|
||||
* '*sinp'. */
|
||||
* '*sinp'.
|
||||
*
|
||||
* 'dscp' If not DSCP_INVALID, its value becomes the DSCP bits in the IP
|
||||
* headers for the new connection. */
|
||||
int
|
||||
inet_open_passive(int style, const char *target, int default_port,
|
||||
struct sockaddr_in *sinp)
|
||||
struct sockaddr_in *sinp, uint8_t dscp)
|
||||
{
|
||||
struct sockaddr_in sin;
|
||||
int fd = 0, error;
|
||||
@@ -701,6 +718,17 @@ inet_open_passive(int style, const char *target, int default_port,
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* The socket options set here ensure that the TOS bits are set during
|
||||
* the connection establishment. If set after connect(), the handshake
|
||||
* SYN frames will be sent with a TOS of 0. */
|
||||
if (dscp != DSCP_INVALID) {
|
||||
if (setsockopt(fd, IPPROTO_IP, IP_TOS, &dscp, sizeof dscp)) {
|
||||
VLOG_ERR("%s: socket: %s", target, strerror(errno));
|
||||
error = errno;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
/* Listen. */
|
||||
if (style == SOCK_STREAM && listen(fd, 10) < 0) {
|
||||
error = errno;
|
||||
|
Reference in New Issue
Block a user