Re: can-utils jacd questions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks, Kurt.

I'll go ahead and make the updates.

-- elenita

On Fri, Dec 6, 2019 at 2:59 AM Kurt Van Dijck
<dev.kurt@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hi,
>
> On do, 05 dec 2019 14:55:53 -0600, Elenita Hinds wrote:
> > Hi all,
> >
> > I am hoping to re-use the can-utils' jacd as default Address Claiming
> > daemon but runs into some issues:
> >
> > (1) " err(0, <string>, ...) " is called in several places, even though
> > looking at the code logic, there is no error and the program should be
> > able to continue. The program exits because err()  never returns.
> > For example:
>
> commit 791b6de7 introduced the problem.
> it replaced all error(x, y, sss) calls with err(y, sss)
> but it should have become warn(y, sss) when x=0.
>
> Feel free to fix that.
>
> > (2) The socket is configured to also set the SO_BINDTODEVICE option.
> > In our system, this requires the program to have root permissions to
> > run but we'd rather not do this for security reasons. Is this option
> > required? What are the side-effects if this option is not set? Can it
> > be made optional such that the program does not exit if the
> > setsockoption(SO_BINDTODEVICE) call fails (seems to work without it)?
>
> It appears on first sight that SO_BINDTODEVICE isn't strictly necessary
> since bind() will have sockaddr_can.can_ifindex set anyway.
> In that case, rather then ignore the result,
> remove the call to SO_BINDTODEVICE completely.
>
> >
> > (3) The claimed address is only saved to a file when the program
> > terminates.  What is the reason for this? Can it not be saved after
> > one is claimed already so that another process can  read it real-time
> > if needed?
>
> That should not be necessary.
> At time of writing jacd, you could consult 'ip addr show can0' to find
> out. I'm not sure what option remained to find it.
> I believe you can, from another program, bind() with the same name, and
> then getsockname() will return the complete sockaddr_can with SA filled
> in.
>
> > Also, in cases of a program crash or a power outage, the
> > claimed address is still saved.
>
> That is a true remark.
> Given a power outage (the program never crashes :-) ),
> and looking at the code, +10 years later, I would now write to a temp file,
> and rename() the file to make it an atomic operation.
> Doing that regularly, or upon change, would be an improvement.
>
> Kurt
> >
> >
> > Thanks in advance,
> > Elenita



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux