NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

setcap cap_net_raw on nilrt 2019

Solved!
Go to solution

Hi, I'm trying to follow these instructions for 2019:

https://forums.ni.com/t5/NI-Linux-Real-Time-Discussions/Raw-packets-support-in-LabView-RT/m-p/346727...

First I getcap lvrt:

getcap lvrt
lvrt = cap_net_bind_service,cap_net_admin,cap_ipc_lock,cap_sys_rawio,cap_sys_boot,cap_sys_nice,cap_sys_time+ep

then I setcap

setcap cap_net_bind_service,cap_net_admin,cap_ipc_lock,cap_sys_rawio,cap_sys_boot,cap_sys_nice,cap_sys_time+ep,cap_net_raw+eip lvrt

and I get back

fatal error: Invalid argument
usage: setcap [-q] [-v] (-r|-|<caps>) <filename> [ ... (-r|-|<capsN>) <filenameN> ]

 Note <filename> must be a regular (non-symlink) file.

If I don't include cap_net_raw (or cap_net_raw+ep or +eip) setcap works fine. Did cap_net_raw get renamed? or does it need special permissions to set?

0 Kudos
Message 1 of 6
(4,326 Views)

I think your capability string is malformed. See https://linux.die.net/man/3/cap_from_text for formatting info:

 

"A textual representation of capability sets consists of one or more whitespace-separated clauses."

"Each clause consists of a list of comma-separated capability names (or the word 'all'), followed by an action-list."

"An action-list consists of a sequence of operator flag pairs. Legal operators are: '=', '+', and '-'. Legal flags are: 'e', 'i', and 'p'."

 

Something like this might work: setcap "aaa,ccc+ep ccc+eip" /path/to/bin

 

0 Kudos
Message 2 of 6
(4,318 Views)

Thanks for checking that. Based on your message I figured I might try just using "all" and seeing if that worked...but unfortunately, I get the same error.

0 Kudos
Message 3 of 6
(4,308 Views)

just reformatted and reinstalled, same issue

0 Kudos
Message 4 of 6
(4,236 Views)
Solution
Accepted by topic author smithedtes

I successfully ran the following on my controller with LabVIEW 2019, logged in as admin via ssh:

 

> setcap "cap_net_bind_service,cap_net_admin,cap_ipc_lock,cap_sys_rawio,cap_sys_boot,cap_sys_nice,cap_sys_time+ep cap_net_raw+eip" /usr/local/natinst/labview/lvrt
> getcap /usr/local/natinst/labview/lvrt
/usr/local/natinst/labview/lvrt = cap_net_raw+eip cap_net_bind_service,cap_net_admin,cap_ipc_lock,cap_sys_rawio,cap_sys_boot,cap_sys_nice,cap_sys_time+ep

 

 

0 Kudos
Message 5 of 6
(4,226 Views)

Ok, hrm, I thought I had tried almost exactly that after your post (in addition to the all), but I guess not.

Thank you for your help, that worked perfectly.

0 Kudos
Message 6 of 6
(4,220 Views)