Re: [RFC 2] Validate required parameters in inet6_validate_link_af

2019-05-15 Thread Maxim Mikityanskiy
On 2019-05-15 02:32, Jakub Kicinski wrote: > On Mon, 13 May 2019 15:05:30 +, Maxim Mikityanskiy wrote: >> +err = -EINVAL; >> + >> +if (tb[IFLA_INET6_ADDR_GEN_MODE]) { >> +u8 mode = nla_get_u8(tb[IFLA_INET6_ADDR_GEN_MODE]); >> + >> +if (check_addr_gen_mode(mode) <

Re: [RFC 2] Validate required parameters in inet6_validate_link_af

2019-05-14 Thread Jakub Kicinski
On Mon, 13 May 2019 15:05:30 +, Maxim Mikityanskiy wrote: > + err = -EINVAL; > + > + if (tb[IFLA_INET6_ADDR_GEN_MODE]) { > + u8 mode = nla_get_u8(tb[IFLA_INET6_ADDR_GEN_MODE]); > + > + if (check_addr_gen_mode(mode) < 0) > + return -EINVAL; > +

[RFC 2] Validate required parameters in inet6_validate_link_af

2019-05-13 Thread Maxim Mikityanskiy
inet6_set_link_af requires that at least one of IFLA_INET6_TOKEN or IFLA_INET6_ADDR_GET_MODE is passed. If none of them is passed, it returns -EINVAL, which may cause do_setlink() to fail in the middle of processing other commands and give the following warning message: A link change request fai