/usr/lib/python2.7/dist-packages/framework/subsystems/onetworkd/dhcp.py is in fso-frameworkd 0.10.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | #!/usr/bin/env python
"""
Network
(C) 2009 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
GPLv2 or later
Package: onetworkd
Module: dhcp
Support for the Dynamic Host Configuration Protocol
"""
MODULE_NAME = "onetworkd"
__version__ = "0.0.1"
from framework.patterns.utilities import killall
from helpers import readFromFile, writeToFile
import subprocess
import logging
logger = logging.getLogger( MODULE_NAME )
ETC_RESOLV_CONF = "/etc/resolv.conf"
ETC_UDHCPD_CONF = "/etc/udhcpd.conf"
#============================================================================#
def launchDaemon():
#============================================================================#
killall( "udhcpd" )
subprocess.call( "udhcpd" )
#============================================================================#
def prepareDaemonConfigurationForInterface( iface ):
#============================================================================#
name = iface.name()
address = iface.ipAddress4()
nameservers = ""
resolv_conf = readFromFile( ETC_RESOLV_CONF ).split( '\n' )
for line in resolv_conf:
if line.startswith( "nameserver" ):
nameserver = line.strip().split( ' ' )[1]
nameservers += nameserver
nameservers += " "
conf_file = daemon_conf_file_template % ( name, nameservers, address )
writeToFile( ETC_UDHCPD_CONF, conf_file )
#============================================================================#
daemon_conf_file_template = """# freesmartphone.org /etc/udhcpd.conf
start 192.168.0.20 # lease range
end 192.168.0.199 # lease range
interface %s # listen on interface
option dns %s # grab from resolv.conf
option subnet 255.255.255.0
opt router %s # address of interface
option lease 864000 # 10 days of seconds
"""
#============================================================================#
|