ncsi-netlink: ncsi-cmd fallback: move -c argument before operation

If a channel argument was used for ncsi-netlink, and we're falling-back
to the ncsi-cmd wrapper, we will place the "-c" argument after the "raw"
command:

```
root@p10bmc:~# strace -e trace=execve ncsi-netlink -x 2 -p 0 -c 0 -o 5000000157200001
execve("/usr/bin/ncsi-netlink", ["ncsi-netlink", "-x", "2", "-p", "0", "-c", "0", "-o", "5000000157200001"], 0x7e98acc8 /* 20 vars */) = 0
<7> ncsi-netlink [..] -o is deprecated by ncsi-cmd
execve("/usr/local/bin/ncsi-cmd", ["ncsi-cmd", "-i", "2", "-p", "0", "raw", "-c", "0", "50", "00000157200001"], 0x7e945ccc /* 20 vars */) = -1 ENOENT (No such file or directory)
execve("/usr/bin/ncsi-cmd", ["ncsi-cmd", "-i", "2", "-p", "0", "raw", "-c", "0", "50", "00000157200001"], 0x7e945ccc /* 20 vars */) = 0
Invalid command type value
+++ exited with 1 +++
```

Instead, move the "raw" argument out of the initial list, and add it
once we have processed the channel.

Tested: we can now call the ncsi-netlink wrapper with -c:

```
root@p10bmc:~# strace -e trace=execve ncsi-netlink -x 2 -p 0 -c 0 -o 5000000157200001
execve("/usr/bin/ncsi-netlink", ["ncsi-netlink", "-x", "2", "-p", "0", "-c", "0", "-o", "5000000157200001"], 0x7e80fcd8 /* 19 vars */) = 0
<7> ncsi-netlink [..] -o is deprecated by ncsi-cmd
execve("/usr/local/bin/ncsi-cmd", ["ncsi-cmd", "-i", "2", "-p", "0", "-c", "0", "raw", "50", "00000157200001"], 0x7ef61cec /* 19 vars */) = -1 ENOENT (No such file or directory)
execve("/usr/bin/ncsi-cmd", ["ncsi-cmd", "-i", "2", "-p", "0", "-c", "0", "raw", "50", "00000157200001"], 0x7ef61cec /* 19 vars */) = 0
```

Which results in the OEM NCSI command being transmitted:

```
07:04:12 [TRACE] rx: NcsiPacket { mc: 0, iid: 29, type: Unknown (50), chan: p0c00, flags: 00, payload: 7: [00, 00, 01, 57, 20, 00, 01] }
```

Reported-by: George Keishing <gkeishin@gmail.com>
Fixes: bad17c0 ("ncsi-cmd: Add a new executable for issuing NCSI commands")
Change-Id: I196ec1b52d34e6b260e9696e4bd1e7c7482a6402
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
1 file changed
tree: 8e5038d407db7151ffd9866fa14aa80a15319b9c
  1. docs/
  2. gen/
  3. src/
  4. subprojects/
  5. test/
  6. yaml/
  7. .clang-format
  8. .clang-tidy
  9. .gitignore
  10. .shellcheck
  11. 60-phosphor-networkd-default.network.in
  12. LICENSE
  13. meson.build
  14. meson.options
  15. OWNERS
  16. README.md
  17. xyz.openbmc_project.Network.conf.in
  18. xyz.openbmc_project.Network.service.in
README.md

phosphor-networkd

To Build

To build this package, do the following steps:

1. meson build
2. ninja -C build