2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

socket_util.py: Make set_dscp() python 2.4.3 compatible.

There is no 'errno' field in socket.error. Instead use the
get_exception_errno() function to get the error number.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Gurucharan Shetty
2014-06-19 10:38:20 -07:00
parent 0f1e8ed05d
commit c620aaae64

View File

@@ -302,11 +302,11 @@ def set_dscp(sock, dscp):
try:
sock.setsockopt(socket.IPPROTO_IP, socket.IP_TOS, val)
except socket.error, e:
if e.errno != errno.ENOPROTOOPT:
if get_exception_errno(e) != errno.ENOPROTOOPT:
raise
success = True
try:
sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_TCLASS, val)
except socket.error, e:
if e.errno != errno.ENOPROTOOPT or not success:
if get_exception_errno(e) != errno.ENOPROTOOPT or not success:
raise