Commit f3dc94fa authored by Pedro Oliveira's avatar Pedro Oliveira

support having different processes manipulating different VRFs

parent abf25568
...@@ -11,7 +11,7 @@ from pimdm import Main ...@@ -11,7 +11,7 @@ from pimdm import Main
from pimdm.daemon.Daemon import Daemon from pimdm.daemon.Daemon import Daemon
from pimdm.tree.globals import MULTICAST_TABLE_ID from pimdm.tree.globals import MULTICAST_TABLE_ID
VERSION = "1.1.1" VERSION = "1.1.1.1"
def client_socket(data_to_send): def client_socket(data_to_send):
...@@ -19,7 +19,7 @@ def client_socket(data_to_send): ...@@ -19,7 +19,7 @@ def client_socket(data_to_send):
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
# Connect the socket to the port where the server is listening # Connect the socket to the port where the server is listening
server_address = '/tmp/pim_uds_socket' server_address = '/tmp/pim_uds_socket' + str(MULTICAST_TABLE_ID)
#print('connecting to %s' % server_address) #print('connecting to %s' % server_address)
try: try:
sock.connect(server_address) sock.connect(server_address)
...@@ -37,7 +37,7 @@ def client_socket(data_to_send): ...@@ -37,7 +37,7 @@ def client_socket(data_to_send):
class MyDaemon(Daemon): class MyDaemon(Daemon):
def run(self): def run(self):
Main.main() Main.main()
server_address = '/tmp/pim_uds_socket' server_address = '/tmp/pim_uds_socket' + str(MULTICAST_TABLE_ID)
# Make sure the socket does not already exist # Make sure the socket does not already exist
try: try:
...@@ -146,7 +146,7 @@ def main(): ...@@ -146,7 +146,7 @@ def main():
if os.geteuid() != 0: if os.geteuid() != 0:
sys.exit('PIM-DM must be run as root!') sys.exit('PIM-DM must be run as root!')
daemon = MyDaemon('/tmp/Daemon-pim.pid') daemon = MyDaemon('/tmp/Daemon-pim' + str(MULTICAST_TABLE_ID) + '.pid')
if args.start: if args.start:
print("start") print("start")
daemon.start() daemon.start()
...@@ -159,7 +159,7 @@ def main(): ...@@ -159,7 +159,7 @@ def main():
daemon.restart() daemon.restart()
sys.exit(0) sys.exit(0)
elif args.verbose: elif args.verbose:
os.system("tail -f /var/log/pimdm/stdout") os.system("tail -f /var/log/pimdm/stdout" + str(MULTICAST_TABLE_ID))
sys.exit(0) sys.exit(0)
elif args.multicast_routes: elif args.multicast_routes:
if args.ipv4 or not args.ipv6: if args.ipv4 or not args.ipv6:
......
"""Generic linux daemon base class for python 3.x.""" """Generic linux daemon base class for python 3.x."""
import sys, os, time, atexit, signal import sys, os, time, atexit, signal
from pimdm.tree.globals import MULTICAST_TABLE_ID
class Daemon: class Daemon:
"""A generic Daemon class. """A generic Daemon class.
...@@ -43,8 +45,8 @@ class Daemon: ...@@ -43,8 +45,8 @@ class Daemon:
sys.stdout.flush() sys.stdout.flush()
sys.stderr.flush() sys.stderr.flush()
si = open(os.devnull, 'r') si = open(os.devnull, 'r')
so = open('stdout', 'a+') so = open('stdout' + str(MULTICAST_TABLE_ID), 'a+')
se = open('stderror', 'a+') se = open('stderror' + str(MULTICAST_TABLE_ID), 'a+')
os.dup2(si.fileno(), sys.stdin.fileno()) os.dup2(si.fileno(), sys.stdin.fileno())
os.dup2(so.fileno(), sys.stdout.fileno()) os.dup2(so.fileno(), sys.stdout.fileno())
......
...@@ -12,8 +12,8 @@ setup( ...@@ -12,8 +12,8 @@ setup(
description="PIM-DM protocol", description="PIM-DM protocol",
long_description=open("README.md", "r").read(), long_description=open("README.md", "r").read(),
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
keywords="PIM-DM Multicast Routing Protocol Dense-Mode Router RFC3973 IPv4 IPv6", keywords="PIM-DM Multicast Routing Protocol PIM Dense-Mode Router RFC3973 IPv4 IPv6",
version="1.1.1", version="1.1.1.1",
url="http://github.com/pedrofran12/pim_dm", url="http://github.com/pedrofran12/pim_dm",
author="Pedro Oliveira", author="Pedro Oliveira",
author_email="pedro.francisco.oliveira@tecnico.ulisboa.pt", author_email="pedro.francisco.oliveira@tecnico.ulisboa.pt",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment