In looking through the source code, there are a couple of things that jump out that would seem to be impacted by running a single command vs. multiple commands.
First this comment in dispatch.c
:
/*
* Wait for packets to come in using poll(). When a packet comes in,
* call receive_packet to receive the packet and possibly strip hardware
* addressing information from it, and then call through the
* bootp_packet_handler hook to try to do something with it.
*/
It would appear that dhcrelay.c
makes use of a polling architecture. This one looks to make use of a timeout (time based) when polling one of the interfaces (for example: -i eth0 or -i eth1).
This would seem to indicate that there is some potential for blocking for one interface while the other is being polled.
Another snippet, this time within the dispatch()
function, it's polling one of the specified interfaces:
/* Wait for a packet or a timeout... XXX */
count = poll(fds, nfds, to_msec);
After the poll function above either times out or receives a packet dhcrelay
moves on to the "next" interface:
/* Get the current time... */
time(&cur_time);
i = 0;
for (l = protocols; l; l = l->next) {
struct interface_info *ip = l->local;
if ((fds[i].revents & (POLLIN | POLLHUP))) {
fds[i].revents = 0;
if (ip && (l->handler != got_one ||
!ip->dead))
(*(l->handler))(l);
if (interfaces_invalidated)
break;
}
i++;
}
interfaces_invalidated = 0;
} while (1);
Notice that the entire dispatch
contains a while(1)
loop.
So what does this all mean?
I would say that if you have a heavily trafficked network with a lot of hosts and your DHCP leases are relatively short, then you may want to consider running 2 instances of dchrelay.
If however, your network is relatively small and your DHCP lease timeouts are relatively long, then running a single instance should be fine.
Some additional things to consider
- Running 2 instances allows you to maintain separate log files for each.
- Running 2 instances allows one relayer to be restarted without impacting the other.