mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@156 8ec27952-4edc-4aab-86aa-e87bb2611832
26 lines
669 B
C
26 lines
669 B
C
/** OPAL Interface setup
|
|
*
|
|
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
|
* @copyright 2014, Institute for Automation of Complex Power Systems, EONERC
|
|
* @file
|
|
*/
|
|
|
|
#include "config.h"
|
|
#include "Interface.h"
|
|
|
|
int if_setup(const char *op, const char *iface, const char *addr)
|
|
{
|
|
char cmd[256];
|
|
|
|
/* Setup remote address */
|
|
snprintf(cmd, 256, "ip addr %s %s/32 dev %s", op, addr, iface);
|
|
if (system(cmd))
|
|
OpalPrint("Failed to add local address to interface");
|
|
|
|
/* Setup route for single IP address */
|
|
snprintf(cmd, 256, "ip route %s %s/32 dev %s", op, addr, iface);
|
|
if (system(cmd))
|
|
OpalPrint("Failed to add route for remote address");
|
|
|
|
return 0;
|
|
}
|