- /* 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;
- }
+ /* The dscp bits must be configured before connect() to ensure that the TOS
+ * field is set during the connection establishment. If set after
+ * connect(), the handshake SYN frames will be sent with a TOS of 0. */
+ error = set_dscp(fd, dscp);
+ if (error) {
+ VLOG_ERR("%s: socket: %s", target, strerror(error));
+ goto exit;