From: Vincent Bernat Date: Sat, 5 Jan 2013 13:49:51 +0000 (+0100) Subject: lldpctl: remove "unconfigure" commands (not implemented) X-Git-Tag: 0.7.0~14^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0a138003b697b1904497e71268d924490d41d194;p=thirdparty%2Flldpd.git lldpctl: remove "unconfigure" commands (not implemented) This seems better to remove them instead of documenting them but not implementing them. The API makes it difficult to implement them for now. --- diff --git a/src/client/actions.c b/src/client/actions.c index 706b9935..8387055d 100644 --- a/src/client/actions.c +++ b/src/client/actions.c @@ -379,13 +379,6 @@ cmd_dot3power(struct lldpctl_conn_t *conn, struct writer *w, return 1; } -#define cmd_no_medlocation_coordinate cmd_not_implemented -#define cmd_no_medlocation_address cmd_not_implemented -#define cmd_no_medlocation_elin cmd_not_implemented -#define cmd_no_medpolicy cmd_not_implemented -#define cmd_no_medpower cmd_not_implemented -#define cmd_no_dot3power cmd_not_implemented - /** * Restrict the command to some ports. */ @@ -520,7 +513,7 @@ register_commands_medloc_elin(struct cmd_node *configure_medlocation) * Register `configure med location` commands. */ static void -register_commands_medloc(struct cmd_node *configure_med, struct cmd_node *unconfigure_med) +register_commands_medloc(struct cmd_node *configure_med) { struct cmd_node *configure_medlocation = commands_new( configure_med, @@ -530,33 +523,6 @@ register_commands_medloc(struct cmd_node *configure_med, struct cmd_node *unconf register_commands_medloc_coord(configure_medlocation); register_commands_medloc_addr(configure_medlocation); register_commands_medloc_elin(configure_medlocation); - - /* MED location (unset) */ - struct cmd_node *unconfigure_medlocation = commands_new( - unconfigure_med, - "location", "MED location configuration", - NULL, NULL, NULL); - commands_new( - commands_new( - unconfigure_medlocation, - "coordinate", "Unconfigure MED location coordinate", - NULL, NULL, NULL), - NEWLINE, "Unconfigure MED location coordinate", - NULL, cmd_no_medlocation_coordinate, NULL); - commands_new( - commands_new( - unconfigure_medlocation, - "coordinate", "Unconfigure MED location address", - NULL, NULL, NULL), - NEWLINE, "Unconfigure MED location address", - NULL, cmd_no_medlocation_address, NULL); - commands_new( - commands_new( - unconfigure_medlocation, - "coordinate", "Unconfigure MED location ELIN", - NULL, NULL, NULL), - NEWLINE, "Unconfigure MED location ELIN", - NULL, cmd_no_medlocation_elin, NULL); } static int @@ -598,34 +564,18 @@ cmd_store_prio_env_value_and_pop2(struct lldpctl_conn_t *conn, struct writer *w, { return cmd_store_something_env_value_and_pop2("priority", env, value); } -static int -cmd_store_app_env_value(struct lldpctl_conn_t *conn, struct writer *w, - struct cmd_env *env, void *value) -{ - return (cmdenv_put(env, "application", value) != -1); -} /** * Register `configure med policy` commands. */ static void -register_commands_medpol(struct cmd_node *configure_med, struct cmd_node *unconfigure_med) +register_commands_medpol(struct cmd_node *configure_med) { struct cmd_node *configure_medpolicy = commands_new( configure_med, "policy", "MED policy configuration", NULL, NULL, NULL); - /* MED policy (un set) */ - struct cmd_node *unconfigure_application = - commands_new( - commands_new( - unconfigure_med, - "policy", "MED policy configuration", - NULL, NULL, NULL), - "application", "MED policy application", - NULL, NULL, NULL); - commands_new( configure_medpolicy, NEWLINE, "Apply new MED policy", @@ -643,14 +593,6 @@ register_commands_medpol(struct cmd_node *configure_med, struct cmd_node *unconf pol_map->string; pol_map++) { char *tag = strdup(totag(pol_map->string)); /* TODO: memory leak, happens once */ - commands_new( - commands_new( - unconfigure_application, - tag, - pol_map->string, - NULL, cmd_store_app_env_value, pol_map->string), - NEWLINE, "Remove specified MED policy", - NULL, cmd_no_medpolicy, NULL); commands_new( configure_application, tag, @@ -771,15 +713,8 @@ register_commands_pow_priority(struct cmd_node *priority, int key) * Register `configure med power` commands. */ static void -register_commands_medpow(struct cmd_node *configure_med, struct cmd_node *unconfigure_med) +register_commands_medpow(struct cmd_node *configure_med) { - commands_new( - commands_new(unconfigure_med, - "power", "MED power configuration", - NULL, NULL, NULL), - NEWLINE, "Disable advertising of LLDP-MED POE-MDI TLV", - NULL, cmd_no_medpower, NULL); - struct cmd_node *configure_medpower = commands_new( configure_med, "power", "MED power configuration", @@ -843,15 +778,8 @@ cmd_check_env_power(struct cmd_env *env, void *nothing) * Register `configure med dot3` commands. */ static void -register_commands_dot3pow(struct cmd_node *configure_dot3, struct cmd_node *unconfigure_dot3) +register_commands_dot3pow(struct cmd_node *configure_dot3) { - commands_new( - commands_new(unconfigure_dot3, - "power", "Dot3 power configuration", - NULL, NULL, NULL), - NEWLINE, "Disable advertising of Dot3 POE-MDI TLV", - NULL, cmd_no_dot3power, NULL); - struct cmd_node *configure_dot3power = commands_new( configure_dot3, "power", "Dot3 power configuration", @@ -971,35 +899,21 @@ register_commands_configure(struct cmd_node *root) "configure", "Change system settings", NULL, NULL, NULL); - struct cmd_node *unconfigure = commands_new( - root, - "unconfigure", - "Unset configuration option", - NULL, NULL, NULL); restrict_ports(configure); - restrict_ports(unconfigure); struct cmd_node *configure_med = commands_new( configure, "med", "MED configuration", NULL, NULL, NULL); - struct cmd_node *unconfigure_med = commands_new( - unconfigure, - "med", "MED configuration", - NULL, NULL, NULL); - register_commands_medloc(configure_med, unconfigure_med); - register_commands_medpol(configure_med, unconfigure_med); - register_commands_medpow(configure_med, unconfigure_med); + register_commands_medloc(configure_med); + register_commands_medpol(configure_med); + register_commands_medpow(configure_med); struct cmd_node *configure_dot3 = commands_new( configure, "dot3", "Dot3 configuration", NULL, NULL, NULL); - struct cmd_node *unconfigure_dot3 = commands_new( - unconfigure, - "dot3", "Dot3 configuration", - NULL, NULL, NULL); - register_commands_dot3pow(configure_dot3, unconfigure_dot3); + register_commands_dot3pow(configure_dot3); } diff --git a/src/client/client.h b/src/client/client.h index 232c688b..1cf91c14 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -51,8 +51,6 @@ int commands_execute(struct lldpctl_conn_t *, struct writer *, char *commands_complete(struct cmd_node *, int argc, const char **argv, int cursorc, int cursoro, int all); /* helpers */ -int cmd_not_implemented(struct lldpctl_conn_t *, struct writer *, - struct cmd_env *, void *); int cmd_check_no_env(struct cmd_env *, void *); int cmd_check_env(struct cmd_env *, void *); int cmd_store_env(struct lldpctl_conn_t *, struct writer *, diff --git a/src/client/commands.c b/src/client/commands.c index 2ac46ed1..65658ee6 100644 --- a/src/client/commands.c +++ b/src/client/commands.c @@ -493,17 +493,6 @@ commands_execute(struct lldpctl_conn_t *conn, struct writer *w, return _commands_execute(conn, w, root, argc, argv, -1, -1, NULL, 0); } -/** - * A generic "not implemented" command. - */ -int -cmd_not_implemented(struct lldpctl_conn_t *conn, struct writer *w, - struct cmd_env *env, void *arg) -{ - log_warnx("lldpctl", "not supported yet"); - return 1; -} - /** * Check if the environment does not contain the given key. * diff --git a/src/client/lldpctl.8 b/src/client/lldpctl.8 index 253b1651..e48bbe20 100644 --- a/src/client/lldpctl.8 +++ b/src/client/lldpctl.8 @@ -236,17 +236,6 @@ padded with 0. Here is an example of use: .D1 configure ports eth2 med location elin 911 .Ed -.Cd unconfigure -.Op ports Ar ethX Op ... -.Cd med location -.Op Cd coordinate | address | elin -.Bd -ragged -offset XXXXXX -Do not advertise the location on the given ports (or on all ports if -no port was provided). Optionally, only remove the specified location -(coordinate-based, address or ELIN number). Here is an example of use: -.D1 unconfigure ports eth0 eth2 med location coordinate -.Ed - .Cd configure .Op ports Ar ethX Op ... .Cd med policy @@ -329,17 +318,6 @@ A valid use of this command is: .D1 configure med policy application voice vlan 500 priority voice dscp 46 .Ed -.Cd unconfigure -.Op ports Ar ethX Op ... -.Cd med policy -.Cd application Ar application -.Bd -ragged -offset XXXXXX -Do not advertise any network policy on the given ports (or on all -ports if no port was provided). Optionally, only remove the specified -application type. Here is an example of use: -.D1 unconfigure ports eth0 eth2 med policy application voice -.Ed - .Cd configure .Op ports Ar ethX Op ... .Cd med power pse | pd @@ -418,14 +396,6 @@ Here is an example of use: .D1 configure med power pd source pse priority high value 5000 .Ed -.Cd unconfigure -.Op ports Ar ethX Op ... -.Cd med power -.Bd -ragged -offset XXXXXX -Do not advertise the LLDP-MED POE-MDI TLV for the given portd (or on all -ports if no port was provided). -.Ed - .Cd configure .Op ports Ar ethX Op ... .Cd dot3 power pse | pd @@ -480,14 +450,6 @@ Here are two valid uses of this command: .D1 configure dot3 power pd supported enabled powerpairs spare class 3 type 1 source pse priority low requested 10000 allocated 15000 .Ed -.Cd unconfigure -.Op ports Ar ethX Op ... -.Cd dot3 power -.Bd -ragged -offset XXXXXX -Do not advertise the Dot3 POE-MDI TLV for the given ports (or on all -ports if no port was provided). -.Ed - .Ed .Sh FILES .Bl -tag -width "/var/run/lldpd.socketXX" -compact