On Mon, Aug 17, 2015 at 01:06:32PM +0200, Martin Pieuchot wrote:
> On 11/08/15(Tue) 16:25, Alexander Bluhm wrote:
> > On Mon, Aug 10, 2015 at 10:43:46PM +0200, Martin Pieuchot wrote:
> > > In general these messages do not help.  Here we have two cases of
> > > messages, either logged at LOG_INFO or LOG_ERR.
> > 
> > Yes, multiple logs for the same error are bad.  But there is a path
> > where we ignore the return code of in6_update_ifa().
> > 
> > in6_update_ifa()
> > in6_ifattach_loopback()
> > in6_ifattach()
> > 
> > The latter is called without error check from
> > if_up()
> > ifioctl()
> > ifnewlladdr()
> > in6_control()
> > 
> > So we should either propagate the error in these functions or add
> > a log somewhere in the call stack.
> 
> What about committing this diff first?

yes, OK bluhm@

> 
> Index: net/if.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if.c,v
> retrieving revision 1.359
> diff -u -p -r1.359 if.c
> --- net/if.c  16 Aug 2015 12:19:06 -0000      1.359
> +++ net/if.c  17 Aug 2015 11:04:39 -0000
> @@ -1314,11 +1314,11 @@ ifioctl(struct socket *so, u_long cmd, c
>               case AF_INET6:
>                       s = splsoftnet();
>                       if (cmd == SIOCIFAFATTACH)
> -                             in6_ifattach(ifp);
> +                             error = in6_ifattach(ifp);
>                       else
>                               in6_ifdetach(ifp);
>                       splx(s);
> -                     return (0);
> +                     return (error);
>  #endif /* INET6 */
>               default:
>                       return (EAFNOSUPPORT);
> @@ -1382,8 +1382,10 @@ ifioctl(struct socket *so, u_long cmd, c
>  #ifdef INET6
>               if (ISSET(ifr->ifr_flags, IFXF_AUTOCONF6)) {
>                       s = splsoftnet();
> -                     in6_ifattach(ifp);
> +                     error = in6_ifattach(ifp);
>                       splx(s);
> +                     if (error != 0)
> +                             return (error);
>               }
>  
>               if ((ifr->ifr_flags & IFXF_AUTOCONF6) &&
> Index: netinet6//in6.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet6/in6.c,v
> retrieving revision 1.162
> diff -u -p -r1.162 in6.c
> --- netinet6//in6.c   12 Aug 2015 09:06:18 -0000      1.162
> +++ netinet6//in6.c   17 Aug 2015 11:00:04 -0000
> @@ -479,7 +479,11 @@ in6_control(struct socket *so, u_long cm
>                * is no link-local yet.
>                */
>               s = splsoftnet();
> -             in6_ifattach(ifp);
> +             error = in6_ifattach(ifp);
> +             if (error != 0) {
> +                     splx(s);
> +                     return (error);
> +             }
>               error = in6_update_ifa(ifp, ifra, ia6);
>               splx(s);
>               if (error != 0)

Reply via email to