Revision 376bcba4 mininet/util.py

View differences:

mininet/util.py
175 175
def fixLimits():
176 176
    '''Fix ridiculously small resource limits.'''
177 177
    setrlimit( RLIMIT_NPROC, (4096, 8192))
178
    setrlimit( RLIMIT_NOFILE, (16384, 32768))
178
    setrlimit( RLIMIT_NOFILE, (16384, 32768))
179

  
180
def macColonHex(mac):
181
    '''Generate MAC colon-hex string from unsigned int.
182

  
183
    @param mac MAC address as unsigned int
184
    @return mac_str MAC colon-hex string
185
    '''
186
    mac_pieces = []
187
    for i in range (5, -1, -1):
188
        mac_pieces.append('%02x' % (((0xff << (i * 8)) & mac) >> (i * 8)))
189
    mac_str = ':'.join(mac_pieces)
190
    return mac_str
191

  
192
def ipStr(ip):
193
    '''Generate IP address string
194

  
195
    @return ip addr string
196
    '''
197
    hi = (ip & 0xff0000) >> 16
198
    mid = (ip & 0xff00) >> 8
199
    lo = ip & 0xff
200
    return "10.%i.%i.%i" % (hi, mid, lo)

Also available in: Unified diff