Skip to content

Commit

Permalink
support having different processes manipulating different VRFs
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrofran12 committed Jun 26, 2020
1 parent abf2556 commit f3dc94f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 5 additions & 5 deletions pimdm/Run.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
from pimdm.daemon.Daemon import Daemon
from pimdm.tree.globals import MULTICAST_TABLE_ID

VERSION = "1.1.1"
VERSION = "1.1.1.1"


def client_socket(data_to_send):
# Create a UDS socket
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)

# 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)
try:
sock.connect(server_address)
Expand All @@ -37,7 +37,7 @@ def client_socket(data_to_send):
class MyDaemon(Daemon):
def run(self):
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
try:
Expand Down Expand Up @@ -146,7 +146,7 @@ def main():
if os.geteuid() != 0:
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:
print("start")
daemon.start()
Expand All @@ -159,7 +159,7 @@ def main():
daemon.restart()
sys.exit(0)
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)
elif args.multicast_routes:
if args.ipv4 or not args.ipv6:
Expand Down
6 changes: 4 additions & 2 deletions pimdm/daemon/Daemon.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Generic linux daemon base class for python 3.x."""

import sys, os, time, atexit, signal
from pimdm.tree.globals import MULTICAST_TABLE_ID


class Daemon:
"""A generic Daemon class.
Expand Down Expand Up @@ -43,8 +45,8 @@ def daemonize(self):
sys.stdout.flush()
sys.stderr.flush()
si = open(os.devnull, 'r')
so = open('stdout', 'a+')
se = open('stderror', 'a+')
so = open('stdout' + str(MULTICAST_TABLE_ID), 'a+')
se = open('stderror' + str(MULTICAST_TABLE_ID), 'a+')

os.dup2(si.fileno(), sys.stdin.fileno())
os.dup2(so.fileno(), sys.stdout.fileno())
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
description="PIM-DM protocol",
long_description=open("README.md", "r").read(),
long_description_content_type="text/markdown",
keywords="PIM-DM Multicast Routing Protocol Dense-Mode Router RFC3973 IPv4 IPv6",
version="1.1.1",
keywords="PIM-DM Multicast Routing Protocol PIM Dense-Mode Router RFC3973 IPv4 IPv6",
version="1.1.1.1",
url="http://github.com/pedrofran12/pim_dm",
author="Pedro Oliveira",
author_email="pedro.francisco.oliveira@tecnico.ulisboa.pt",
Expand Down

0 comments on commit f3dc94f

Please sign in to comment.