summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* util: Don't ignore non-running interfacesHEADmasterWilliam A. Kennington III2019-04-111-2/+2
| | | | | | | | | | | | | We want to be able to configure interfaces which are not running. Just because we don't have a cable plugged into the machine doesn't mean we don't want to have the option to configure it from the host Tested: Built an image and made sure the interface was now present and configurable even if it had no link present. Change-Id: Ib93ddddc8ca015fe024209fa9cbeb5fc24421728 Signed-off-by: William A. Kennington III <wak@google.com>
* vlan: Modify create method to return an ObjectPathWilliam A. Kennington III2019-04-095-5/+12
| | | | | | | | This will be nice to have for ipmid so that it can easily figure out the path of the new vlan object when it creates one. Change-Id: I6b93c5e64499c0cb9e36e8354eda6089bfd6d6c9 Signed-off-by: William A. Kennington III <wak@google.com>
* util: Use standard ether functions for conversionWilliam A. Kennington III2019-04-092-16/+19
| | | | | | | | This should be slightly faster and is more standard for interop with other programs using the same conversion functions. Change-Id: I4d7a2cb4df2173afda421c5b41ee5e98e722d6c6 Signed-off-by: William A. Kennington III <wak@google.com>
* build: Use libnl package config instead of hardcodingWilliam A. Kennington III2019-04-092-3/+3
| | | | | | | | | | | We shouldn't be hardcoding paths and link stages against libnl since it provides the needed package config files to do that for us. Tested: Builds and passes unit tests in our unit test container environment. Change-Id: I46277fff25720119c90b827b4a3d7333bbe8766b Signed-off-by: William A. Kennington III <wak@google.com>
* Network:Modified create interface to return the D-Bus object IDraviteja-b2019-04-043-4/+11
| | | | | | | | Currently, the create interface doesn't return the Object identifier, this commit is to modify Create Inferface to return the object identifier. Change-Id: Icbd30481a1173a0c2b8dbe32ba913504555a119a Signed-off-by: raviteja-b <raviteja28031990@gmail.com>
* Makefile: Fix bad system header flagWilliam A. Kennington III2019-03-211-1/+1
| | | | | | | | | gcc does not guarantee support for -isystem=<directory> syntax. It typically expects the flag to be in the form of 2 arguments `-isystem <directory>`. Update this so it works with all versions of gcc. Change-Id: I324446b414bc327961641c39dd36a3131c3bc5e1 Signed-off-by: William A. Kennington III <wak@google.com>
* configure: Remove systemd dbus pathsWilliam A. Kennington III2019-03-122-4/+4
| | | | | | | | | Nothing but our code references these variable so lets just define them where they are needed instead of having the configure script populate them. Change-Id: Ibd08d0698488febf5ea1cc8d6c14379ea6a50051 Signed-off-by: William A. Kennington III <wak@google.com>
* configure: Cleanup dbus variablesWilliam A. Kennington III2019-03-124-13/+11
| | | | | | | | | | | | These are realistically not configurable by the end user and could be provided as a runtime configuration if needed so that custom networkd binaries are not needed for each different busname. Configure variable substitution was kept to ensure the value is consistent between all of the source files. Change-Id: Ic6d50a80b48e2cfc07e48067089236010894e71b Signed-off-by: William A. Kennington III <wak@google.com>
* configure: Don't allow configurable systemd directoriesWilliam A. Kennington III2019-03-122-10/+5
| | | | | | | | | They are not actually variable and defined statically in systemd. This will make porting to other build systems easier so that we don't have to duplicate this functionality. Change-Id: I7752cf4caf12d4424e21cd04276e0f87ecddc335 Signed-off-by: William A. Kennington III <wak@google.com>
* test: rtnetlink: use manager interface queryPatrick Venture2019-03-122-11/+2
| | | | | | | | Use the new interface query method provided by manager to know if the interface was added instead of inspecting the manager itself. Change-Id: I94600199fd60a014d6b376155555449f7af617f5 Signed-off-by: Patrick Venture <venture@google.com>
* test: use mocked sdbus interface for sdbusplusPatrick Venture2019-03-051-2/+3
| | | | | | | | | | | | | Use mocked sdbus interface for sdbusplus such that it doesn't require talking to the real dbus interfaces. The warnings for the unexpected calls on the sdbus interface can be ignored in the cases for this test as returning 0 is the desired behavior. The warnings can be trivially handled by expecting the calls, or setting up "ON_CALL" statements. Change-Id: I8c72eaec957fb6a68eeaac982c1f45998487c35f Signed-off-by: Patrick Venture <venture@google.com>
* configure: Simplify link local autoconfigurationWilliam A. Kennington III2019-02-281-9/+8
| | | | | | | | | We should either define a variable or not based on the truth value of the configure flag. This change removes the AC_ARG_VAR that is duplicating the functionality of the AC_ARG_ENABLE. Change-Id: Ia77a1a7b5535418a268a3dd2d08ed488b8c6ae18 Signed-off-by: William A. Kennington III <wak@google.com>
* configure: Make dbus dir depend on the sysconf make variableWilliam A. Kennington III2019-02-281-1/+1
| | | | | | | | | We want the directory path to be based on the sysconfdir as defined during the make process. This way anyone overriding sysconfdir during install won't have to also override the dbus directory. Change-Id: Icfb8f381e29630592949abb411769ac1829002ae Signed-off-by: William A. Kennington III <wak@google.com>
* configure: Simplify PKG_CHECK_MODULESWilliam A. Kennington III2019-02-281-13/+4
| | | | | | | | | When provided with no action, PKG_CHECK_MODULES errors out with a similar message to what we are providing directly. Rely on that mechanism instead of our own errors. Change-Id: I2344b510baf47469f424e1cf3f4e92398b743d1a Signed-off-by: William A. Kennington III <wak@google.com>
* IPv6 gateway supportWilliam A. Kennington III2019-02-215-7/+56
| | | | | | | | | | | | | | This implements the dbus interface plumbing needed to properly get and set the defaultGateway6 property. Tested: Made sure manual changes to the default route were discovered. Changed the route via the dbus interface and saw it write the correct entry to the .network file. Ensured that restarting the daemon and the BMC preserved the defaultGateway6 field. Change-Id: Ida6a168e0df0a42b4e0d3f6d569ec2fe1f9adaab Signed-off-by: William A. Kennington III <wak@google.com>
* rtnetlink_server: Refresh for route changesWilliam A. Kennington III2019-02-191-1/+4
| | | | | | | | | | | | | We want to make sure we update the DefaultGateway if it changes. Otherwise when someone changes our gateway we don't update the state of the phosphor-network daemon. Tested: Editted the default route manually through netlink and saw the update get picked up in the dbus interface. Change-Id: Ib4f5bafbdb7615e235f47bc8fa372396491e69e6 Signed-off-by: William A. Kennington III <wak@google.com>
* routing_table: Parse v6 routesWilliam A. Kennington III2019-02-191-14/+25
| | | | | | | | | | | | | Since we ultimately handle all of the routes as strings it is safe to include v6 routes into the table so that we can later support using those. This has no effect on observed behavior. Tested: Used a future change to validate that this was parsing the default gateway for ipv6 and that old ipv4 parsing still works as expected. Change-Id: I0fec5788ab31f7b1c4f7f0d7a34023ccdb15d9ba Signed-off-by: William A. Kennington III <wak@google.com>
* test: use system-first search for dbus interfacesPatrick Venture2019-02-182-2/+2
| | | | | | | Use system-first search for inclusion of dbus interface headers. Change-Id: I9953ca047c09c1003c86b1ffaf929698c157139c Signed-off-by: Patrick Venture <venture@google.com>
* test: use expect_throw to catch expected exceptionsPatrick Venture2019-02-181-11/+1
| | | | | | | Use expect_throw to catch expected exceptions in tests. Change-Id: I410655a43328d44c5b9f95dff509c132499bcd07 Signed-off-by: Patrick Venture <venture@google.com>
* test: use real manager object for testingPatrick Venture2019-02-183-18/+24
| | | | | | | | Use the real manager object for testing the manager object instead of a derived object. Change-Id: I3b4a401d43457bffb22de8fac5e29b2e2887c6c6 Signed-off-by: Patrick Venture <venture@google.com>
* ethernet_interface: Only write Gateway= lines when presentWilliam A. Kennington III2019-02-141-2/+5
| | | | | | | | | | | | | | This doesn't affect the total system behavior but it cleans up error output from systemd-networkd which doesn't like empty Gateway= lines when we don't have a set gateway. Tested: Set the system to a static configuration with no gateway configured and saw that the line was no longer written. Configured a gateway and the line is written as expected. Change-Id: I1ff9c4f564fab54d0c54e3f87fcd50b623f0fbda Signed-off-by: William A. Kennington III <wak@google.com>
* rtnetlink_server: Refactor out the refresh checkWilliam A. Kennington III2019-02-141-2/+15
| | | | | | | | No functional change but this will make it cleaner when adding more types of message to refresh on. Change-Id: I29ad0d6037fad85efb48394af0517580a3f2216f Signed-off-by: William A. Kennington III <wak@google.com>
* ethernet_interface: Link local IPs are never DHCPWilliam A. Kennington III2019-02-141-1/+1
| | | | | | | | | The concept of an interface having a link local IP is orthogonal to DHCP vs static addressing and we should never be receiving a link local IP over DHCP. Change-Id: I80040054f8c9acad3d3d0afa12c5738b43957a4a Signed-off-by: William A. Kennington III <wak@google.com>
* util: Add a MacAddr population functionWilliam A. Kennington III2019-02-143-0/+29
| | | | | | | | | | | | This one is pretty trivial since there is only one size of mac address, but we want to be sure we validate the buffer. Tested: Built and runs through unit tests. Works when integrated into neighbor parsing code. Change-Id: Iaf58fc398b51a3bcbbf70968cbe353beeb7b9f54 Signed-off-by: William A. Kennington III <wak@google.com>
* util: Add InAddrAny population functionWilliam A. Kennington III2019-02-143-0/+58
| | | | | | | | | | | | We commonly want to be able to turn netlink network order address data into the corresponding InAddrAny when parsing netlink data. This makes it trivial given the address family and data buffer. Tested: Ran throgh unit tests and builds fine in a BMC image. Change-Id: I4ebe1dbd284f150ea03ee091cddda5a06806c01f Signed-off-by: William A. Kennington III <wak@google.com>
* util: Add a function for converting IP bytes to stringsWilliam A. Kennington III2019-02-143-0/+66
| | | | | | | | | | We need this for future work which turns netlink data into IP addresses. Tested: Run through unit tests. Change-Id: If078b28246509ca2ebd3bf7bab652b84258df0bd Signed-off-by: William A. Kennington III <wak@google.com>
* util: Add a function for converting MAC addressesWilliam A. Kennington III2019-02-143-0/+51
| | | | | | | | | | | We need to be able to convert a mac addresses from byte form into our typical human readable string form. Tested: Unit tests pass. Change-Id: I6e68cfefd4d5962e1125c1b5229e61fce475729a Signed-off-by: William A. Kennington III <wak@google.com>
* types: Add types for IPs and MACs in byte formWilliam A. Kennington III2019-02-141-0/+8
| | | | | | | | This will be used by future code, mainly for storing data retrieved over netlink in a typesafe way. Change-Id: I663e7cdf5876397426338f6a733aa6a7dd8fca95 Signed-off-by: William A. Kennington III <wak@google.com>
* build: drop duplicate LT_INIT line from configure_acPatrick Venture2019-01-281-3/+0
| | | | | | | Drop duplicate LT_INIT line from configure_ac. Change-Id: I7e3c55c944d1e65c56740d6f24c8dea14c301952 Signed-off-by: Patrick Venture <venture@google.com>
* move service file, dbus conf into repoPatrick Venture2019-01-284-0/+65
| | | | | | | | | | | | Move the service file for phosphor-networkd from the bitbake recipe to the source repository. Move the dbus configuration file for phosphor-network from a generated file to the source repository. Tested: Verified dbus conf and service file were installed where expected. Change-Id: Idd1a1872aeb020f6b0e2eb9dba7c2e96198be2af Signed-off-by: Patrick Venture <venture@google.com>
* ethernet_interface: Clean up object creationWilliam A. Kennington III2019-01-181-10/+16
| | | | | | | | | | | | This cleans up the loop and makes sure the interface parsing code updates the local variables for each iteration of the loop. Tested: Built and verified that objects were still being created as expected. Change-Id: I5ba442538f6d2b5a4dc6a8a1261777c0303818d1 Signed-off-by: William A. Kennington III <wak@google.com>
* util: Reset Failed Before Restarting ServiceWilliam A. Kennington III2019-01-181-0/+15
| | | | | | | | | | | | | | | | If we don't reset the failed counter in systemd for a specific service like systemd-networkd, restarts won't always be issued as expected. If the service fails due to a bad configuration, future changes that would normally put it in a valid state will be unable to restart it since it hit the reset threshold for the given time window. Tested: Built and ran on a zaius for testing. Issuing bad network configuration changes over ipmi no longer prevents future changes from fixing systemd-networkd. Change-Id: I646309001a257b12e2df006d8c420c93c5c0bca8 Signed-off-by: William A. Kennington III <wak@google.com>
* rtnetlink: Remove redundtant hasExpired() checkWilliam A. Kennington III2018-12-061-2/+1
| | | | | | | | | | | | We don't need to check if the timer is expired and enabled because the timer will never be expired if it is enabled. Tested: Built and networkd still receives link state transitions and populates the discovered ip addresses correctly. Change-Id: I066842af9046190541f868d25319016f34012de3 Signed-off-by: William A. Kennington III <wak@google.com>
* build: use PKG_CHECK_MODULES for phosphor-dbus-interfacesPatrick Venture2018-12-061-3/+3
| | | | | | | | | | | For the phosphor-dbus-interfaces check, use PKG_CHECK_MODULES. The CI wasn't checking for this macro to know to pull phosphor-dbus-interfaces Also, for consistency. There is not an advantage to using this instead of the regular package script. Change-Id: I3c7f2dc4830d461078a1fd35b7ecd72c7260b3b2 Signed-off-by: Patrick Venture <venture@google.com>
* Re-enable unit testRatan Gupta2018-11-3010-34/+71
| | | | | | | | | | | | Unit test were broken after sd bus calls started throwing exception, In this repo we start the systemd-networkd with the use of sd bus calls, which throws exception and it was not handled in the test case. This commit fixes the problem by mocking the network manager which mock the functionality of function which makes the sdbus call. Change-Id: I5b60a2117a661cffa36200415ca611b85dd2fda1 Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
* Don't report/commit the errorRatan Gupta2018-11-301-2/+2
| | | | | | | | | If unable to fetch the networkID from the IP address string This is kind of internal failure where reporting is not needed and no service action is associated with it. Change-Id: Ia54226f2dd77a69fd23433730c424ee0e3c6ac57 Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
* Move the restart systemdunit function to network managerRatan Gupta2018-11-305-21/+24
| | | | | Change-Id: I647741fc3976ca82c39998a518b1de7be5365e80 Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
* Fix checking the status of timerAlexander Filippov2018-11-291-1/+2
| | | | | | | | | | | | | With the new implementation of the timer (the commit 3a70fa24fc016a06b0dc2ecdc3c7275d1f25425c), we catch the bug in the logic of the rt-link events handler: If the timer is not started yet, it will never expire. This commit adds the additional check for the timer activity. Resolves openbmc/openbmc#3437 Change-Id: I0f8c165c626cc649af8d6550407d2a640f691fce Signed-off-by: Alexander Filippov <a.filippov@yadro.com>
* Fix std::variant usageWilliam A. Kennington III2018-11-212-2/+2
| | | | | | | | This cleans up the use of mapbox only .get() variant apis in favor of the std::get() interface which both implementations provide. Change-Id: I9ba8301801d68b391fa5195de37b2b0ecec26edf Signed-off-by: William A. Kennington III <wak@google.com>
* cleanup: add constref to parameters in routing_tablePatrick Venture2018-11-211-2/+4
| | | | | | | | routing_table.hpp: Add const reference to string parameters in constructor. Change-Id: I29a4a7db17706eb48cffcd7e6b0c2d72191e27f8 Signed-off-by: Patrick Venture <venture@google.com>
* minor cleanup, std namespacing, dropping headersPatrick Venture2018-11-213-9/+6
| | | | | | | | Added std namespace to places where there is a cpp version, and dropped unused c headers where found. Change-Id: Ife538ad73042b020ee2987b70e1f021b9926b2bf Signed-off-by: Patrick Venture <venture@google.com>
* network_manager_main: errno is not negativeWilliam A. Kennington III2018-09-271-2/+1
| | | | | | | | | | | This looks like it got copied from somewhere. Don't negate the errno, just return it as-is. Tested: Compiled as expected. Change-Id: I6b28030bf211d12bacab6b69191406e612a6e45f Signed-off-by: William A. Kennington III <wak@google.com>
* network_manager_main: Use logging classes up frontWilliam A. Kennington III2018-09-271-6/+6
| | | | | | | | | | | This makes them accessible throughout the file and disambiguates what can propagate from the phosphor::logging namespace. Tested: Compiles as expected. Change-Id: I36a6407e4313c8c2436e7cd3efd8c99ca385882e Signed-off-by: William A. Kennington III <wak@google.com>
* Migrate to a common timer classWilliam A. Kennington III2018-09-2711-267/+36
| | | | | | | | | | | | This change pulls in sdeventplus and uses the timer implementation as a drop in for the currently included timer. Tested: Unit tests still build but are not currently running. Manually tested this change on a zaius machine and made sure timers went off. Change-Id: I2808196581fc766843931403b83fead16926b0ae Signed-off-by: William A. Kennington III <wak@google.com>
* configure: Use c++17William A. Kennington III2018-09-251-1/+1
| | | | | | | | | | | | | This is needed to start using c++17 libraries and the code should already be trivially compatible. We can't move away from std::experimental::filesystem yet as that requires gcc8+. Tested: Project still builds in the unit test environment although no tests are actually run. Change-Id: I4db0bfe3d42be58d5296eddf5dea5383b7847374 Signed-off-by: William A. Kennington III <wak@google.com>
* Fix formatting issuesRatan K Gupta2018-09-153-28/+9
| | | | | | | | Some of the formatting issues which brought by the earlier commit(clang-formatting) is fixed with this commit. Signed-off-by: Ratan K Gupta <ratagupt@linux.vnet.ibm.com>
* clang-format: Update to match docs repoGunnar Mills2018-09-1545-1907/+1796
| | | | | | | | | Update the .clang-format file and run clang-format-6.0. This .clang-format matches the example one in https://github.com/openbmc/docs/blob/master/cpp-style-and-conventions.md#clang-formatting Change-Id: Ia331c9a5b040e1a3c45a0ebf1b8d776d93b05ae5 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Throw InternalFailure in catchGunnar Mills2018-09-051-1/+1
| | | | | | | | Throw an InternalFailure if unable to get the MAC Address from Inventory. Change-Id: I35f089bcb53ad1796a257a083a9b7ab67b0af496 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Correct spacingGunnar Mills2018-09-051-1/+1
| | | | | | | Added tabs to match. Noticed in a review. Change-Id: I86a93a3323e09beeba07e08424374157aeb7b2d3 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Add -flto to CXXFLAGSAndrew Geissler2018-09-051-1/+3
| | | | | | | | | | Per openbmc/openbmc#3364, adding -flto to CXX flags in order to reduce overall library and binary sizes. Ref: https://gcc.gnu.org/wiki/LinkTimeOptimization Change-Id: I435596a2e0b134f5220bc9521568354fe9338a79 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
OpenPOWER on IntegriCloud