fipvlan has an internal 'debug' option, which provides additional information. So we should add a switch '--debug' to allow this option to set from the command line.
Signed-off-by: Hannes Reinecke <h...@suse.de> --- doc/fipvlan.8 | 7 ++++++- fipvlan.c | 15 +++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/doc/fipvlan.8 b/doc/fipvlan.8 index 76b8db1..0be1343 100644 --- a/doc/fipvlan.8 +++ b/doc/fipvlan.8 @@ -22,7 +22,7 @@ fipvlan \- Fibre Channel over Ethernet VLAN Discovery .sp \fBfipvlan\fR [\-c|\-\-create] [\-s|\-\-start] \fIinterfaces\fR .sp -\fBfipvlan\fR \-a|\-\-auto [\-c|\-\-create] [\-s|\-\-start] +\fBfipvlan\fR \-a|\-\-auto [\-c|\-\-create] [\-d|\-\-debug] [\-s|\-\-start] .sp \fBfipvlan\fR \-h|\-\-help .sp @@ -44,6 +44,11 @@ Use all Ethernet interfaces currently available Create network interfaces for discovered FCoE VLANs\&. If a VLAN device already exists for a discovered VLAN, a new VLAN device will not be created\&. .RE .PP +\fB\-d\fR, \fB\-\-debug\fR +.RS 4 +Enable debugging output +.RE +.PP \fB\-s\fR, \fB\-\-start\fR .RS 4 Start the diff --git a/fipvlan.c b/fipvlan.c index 37ec035..273424b 100644 --- a/fipvlan.c +++ b/fipvlan.c @@ -63,12 +63,14 @@ struct { bool automode; bool create; bool start; + bool debug; char suffix[256]; } config = { .namev = NULL, .namec = 0, .automode = false, .create = false, + .debug = false, .suffix = "", }; @@ -329,8 +331,8 @@ void rtnl_recv_newlink(struct nlmsghdr *nh) int origdev = 1; bool running; - FIP_LOG_DBG("RTM_NEWLINK: ifindex %d, type %d", - ifm->ifi_index, ifm->ifi_type); + FIP_LOG_DBG("RTM_NEWLINK: ifindex %d, type %d, flags %x", + ifm->ifi_index, ifm->ifi_type, ifm->ifi_flags); /* We only deal with Ethernet interfaces */ if (ifm->ifi_type != ARPHRD_ETHER) @@ -404,12 +406,13 @@ void rtnl_recv_newlink(struct nlmsghdr *nh) /* command line arguments */ -#define GETOPT_STR "acf:shv" +#define GETOPT_STR "acdf:shv" static const struct option long_options[] = { { "auto", no_argument, NULL, 'a' }, { "create", no_argument, NULL, 'c' }, { "start", no_argument, NULL, 's' }, + { "debug", no_argument, NULL, 'd' }, { "suffix", required_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'v' }, @@ -423,6 +426,7 @@ static void help(int status) "Options:\n" " -a, --auto Auto select Ethernet interfaces\n" " -c, --create Create system VLAN devices\n" + " -d, --debug Enable debugging output\n" " -s, --start Start FCoE login automatically\n" " -f, --suffix Append the suffix to VLAN interface name\n" " -h, --help Display this help and exit\n" @@ -447,6 +451,9 @@ void parse_cmdline(int argc, char **argv) case 'c': config.create = true; break; + case 'd': + config.debug = true; + break; case 's': config.start = true; break; @@ -733,7 +740,7 @@ int main(int argc, char **argv) parse_cmdline(argc, argv); sa_log_prefix = exe; sa_log_flags = 0; - enable_debug_log(0); + enable_debug_log(config.debug); if (checkcaps()) { FIP_LOG("must run as root or with the NET_RAW capability"); -- 1.7.3.4 _______________________________________________ devel mailing list devel@open-fcoe.org https://lists.open-fcoe.org/mailman/listinfo/devel