{
fprintf(f,
"Usage:\tip link add name NAME type hsr slave1 SLAVE1-IF slave2 SLAVE2-IF\n"
-"\t[ supervision ADDR-BYTE ]\n"
+"\t[ supervision ADDR-BYTE ] [version VERSION]\n"
"\n"
"NAME\n"
" name of new hsr device (e.g. hsr0)\n"
" the two slave devices bound to the HSR device\n"
"ADDR-BYTE\n"
" 0-255; the last byte of the multicast address used for HSR supervision\n"
-" frames (default = 0)\n");
+" frames (default = 0)\n"
+"VERSION\n"
+" 0,1; the protocol version to be used. (default = 0)\n");
}
static void usage(void)
{
int ifindex;
unsigned char multicast_spec;
+ unsigned char protocol_version;
while (argc > 0) {
if (matches(*argv, "supervision") == 0) {
invarg("ADDR-BYTE is invalid", *argv);
addattr_l(n, 1024, IFLA_HSR_MULTICAST_SPEC,
&multicast_spec, 1);
+ } else if (matches(*argv, "version") == 0) {
+ NEXT_ARG();
+ if (!(get_u8(&protocol_version, *argv, 0) == 0 ||
+ get_u8(&protocol_version, *argv, 0) == 1))
+ invarg("version is invalid", *argv);
+ addattr_l(n, 1024, IFLA_HSR_VERSION,
+ &protocol_version, 1);
} else if (matches(*argv, "slave1") == 0) {
NEXT_ARG();
ifindex = ll_name_to_index(*argv);