File: sockfix.py

package info (click to toggle)
python-pysnmp4 7.1.21-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,564 kB
  • sloc: python: 33,654; makefile: 166; javascript: 4
file content (28 lines) | stat: -rw-r--r-- 678 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
# License: https://www.pysnmp.com/pysnmp/license.html
#
import socket

from pysnmp import debug


SYMBOLS = {
    "IP_PKTINFO": 8,
    "IP_TRANSPARENT": 19,
    "SOL_IPV6": 41,
    "IPV6_RECVPKTINFO": 49,
    "IPV6_PKTINFO": 50,
    "IPV6_TRANSPARENT": 75,
}

for symbol, value in SYMBOLS.items():
    if not hasattr(socket, symbol):
        setattr(socket, symbol, value)

        debug.logger & debug.FLAG_IO and debug.logger(
            "WARNING: the socket module on this platform misses option %s. "
            "Assuming its value is %d." % (symbol, value)
        )