-// $Id: chbind.c,v 1.9 2004/03/16 14:30:10 ensc Exp $
+// $Id: chbind.c 2588 2007-08-16 02:31:33Z dhozac $
// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
// based on chbind.cc by Jacques Gelinas
#include "vserver.h"
#include "util.h"
+#include <lib/internal.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ENSC_WRAPPERS_PREFIX "chbind: "
#define ENSC_WRAPPERS_IO 1
#define ENSC_WRAPPERS_UNISTD 1
+#define ENSC_WRAPPERS_VSERVER 1
#include "wrappers.h"
#define CMD_HELP 0x1000
#define CMD_SILENT 0x2000
#define CMD_IP 0x2001
#define CMD_BCAST 0x2002
+#define CMD_NID 0x2003
int wrapper_exit_code = 255;
{ "silent", no_argument, 0, CMD_SILENT },
{ "ip", required_argument, 0, CMD_IP },
{ "bcast", required_argument, 0, CMD_BCAST },
+ { "nid", required_argument, 0, CMD_NID },
{ 0,0,0,0 }
};
WRITE_MSG(fd, "Usage:\n ");
WRITE_STR(fd, cmd);
WRITE_MSG(fd,
- " [--silent] [--ip <ip_num>[/<mask>]] [--bcast <broadcast>] [--] <commands> <args>*\n\n"
+ " [--silent] [--nid <nid>] [--ip <ip_num>[/<mask>]] [--bcast <broadcast>] [--] <commands> <args>*\n\n"
"Please report bugs to " PACKAGE_BUGREPORT "\n");
exit(res);
case CMD_VERSION : showVersion();
case CMD_SILENT : is_silent = true; break;
case CMD_BCAST : readBcast(optarg, &bcast); break;
+ case CMD_NID : WRITE_MSG(2, "WARNING: --nid is not supported by this version\n"); break;
case CMD_IP :
if (nbaddrs>=nb_ipv4root) {
WRITE_MSG(2, "Too many IP numbers, max 16\n");
default :
WRITE_MSG(2, "Try '");
WRITE_STR(2, argv[0]);
- WRITE_MSG(2, " --help\" for more information.\n");
+ WRITE_MSG(2, " --help' for more information.\n");
exit(wrapper_exit_code);
break;
}
exit(wrapper_exit_code);
}
-
+#if !defined(VC_ENABLE_API_COMPAT) && !defined(VC_ENABLE_API_LEGACY)
+# warning building a dummy chbind-compat with no available APIs
+#endif
+
+#if defined(VC_ENABLE_API_COMPAT) || defined(VC_ENABLE_API_LEGACY)
if (vc_set_ipv4root(bcast,nbaddrs,ips)!=0) {
perror("chbind: vc_set_ipv4root()");
exit(wrapper_exit_code);
}
+#else
+ {
+ WRITE_MSG(2, "chbind: kernel does not provide network isolation\n");
+ exit(wrapper_exit_code);
+ }
+#endif
if (!is_silent) {
size_t i;