summaryrefslogtreecommitdiffstats
path: root/ethernet_interface.cpp
Commit message (Collapse)AuthorAgeFilesLines
* vlan: Modify create method to return an ObjectPathWilliam A. Kennington III2019-04-091-1/+3
| | | | | | | | 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>
* Network:Modified create interface to return the D-Bus object IDraviteja-b2019-04-041-2/+3
| | | | | | | | 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>
* IPv6 gateway supportWilliam A. Kennington III2019-02-211-0/+5
| | | | | | | | | | | | | | 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>
* 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>
* 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>
* 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>
* Move the restart systemdunit function to network managerRatan Gupta2018-11-301-2/+2
| | | | | Change-Id: I647741fc3976ca82c39998a518b1de7be5365e80 Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
* minor cleanup, std namespacing, dropping headersPatrick Venture2018-11-211-5/+5
| | | | | | | | 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>
* Fix formatting issuesRatan K Gupta2018-09-151-20/+6
| | | | | | | | 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-151-143/+112
| | | | | | | | | 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>
* reorder headersPatrick Venture2018-08-271-6/+5
| | | | | | | | | | | | | | | | | | Reordering all the headers to the following structure: header file: local c cpp (including openbmc libraries) source file: source.hpp (if applicable) local c cpp Change-Id: Ia74a5c761a3029819366159de3cfd40c5e4c4a2c Signed-off-by: Patrick Venture <venture@google.com>
* Add configure option to disable link-local IP address autoconfiguration.Oskar Senft2018-08-131-1/+9
| | | | | Change-Id: I845ec44a305e91a4880dc1266a3d212db0b4737c Signed-off-by: Oskar Senft <osk@google.com>
* Throw error when invalid MAC Address is setGunnar Mills2018-06-201-6/+9
| | | | | | | | | | | | sdbusplus supports errors on properties, so we can now throw exceptions on such cases as invalid parameters. Also changed the journal log levels to ERR. Tested: Built an image and see invalid parameter errors on values like garbage MAC addresses and non-admin MAC Addresses. Change-Id: I69687bbf34fe51f0c812f40dfc99bb88ce141a2f Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Fixing unnecessary moving of variablesRatan Gupta2018-05-041-2/+2
| | | | | | | | Prior to this fix variable was being used even its memory was moved which can lead to undefined behaviour. Change-Id: Ibb611fd699df6f30bcfeaa66d151920556dac64e Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Write Separate Route section for different RoutesRatan Gupta2018-05-041-1/+1
| | | | | | | Each route should be its own Route Section. Change-Id: I697d9d7e1cf2b1656cea7c31f9c342067a486fd2 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Move DHCP=xxx to Network section in n/w config file.Nagaraju Goruganti2018-03-261-3/+4
| | | | | | | | | | | | | With the changes done for the issue #2891, we are adding DHCP section always into n/w config file, irrespective of DHCP enabled or not. With those new changes when DHCP is disabled(i.e in static case) DHCP=xxx entry is getting added into Route section and causing the issue. Resolves openbmc/openbmc#3030 Change-Id: I97b30129de97eff5d25e78a09e9cb713c45ad4a7 Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
* Get DHCP configuration values form n/w config file while creatingNagaraju Goruganti2018-03-151-53/+54
| | | | | | | | | | | | | | DHCP config object. Each time when we update config file we recreate DHCP config object, with existing code DHCP configuration values are getting initialized to default values. With these changes we get DHCP configuration values from n/w config. Resolves openbmc/openbmc#2891 Change-Id: I95d50d52a8aa569493739a46b88e4a378e399698 Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
* Reduce journal logsRatan Gupta2018-03-151-15/+17
| | | | | | | | | | | | | | | | | | | | Presently the code was creating the elog during reading of the values from the config parser which creates the journal log internally("Internal error Occured") Apart from creating elog,Code also logs into the journal more descriptive message saying which section and key was not found. The code which catches the exception that also logs into the journal. In the changed approach instead of throwing exception we are returning the return code as not finding a section or key in the network config file is not an error. Change-Id: Ib89a3af6541fdf93fb5fa9a8e583d6c6ed88da79 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Set MAC address only when it changesPatrick Venture2018-02-281-0/+7
| | | | | | | | | If the MAC address hasn't been set or has changed, set it. Otherwise, don't set it because it will cause the link to reset. Change-Id: I9018df6a3fa4743894bc0f3cd47bdf1be71632e4 Signed-off-by: Patrick Venture <venture@google.com>
* Add more DHCP attributes while writing the configuration fileNagaraju Goruganti2018-02-151-0/+4
| | | | | | | | Added the attribute "SendHostname", when it is true machine's hostname will be included in DHCP packet. Change-Id: I9bf5f76980f152d48f7f3acf7448c8bc199905bb Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
* Reload systemd-networkd on NTPServer changesLei YU2018-02-011-2/+2
| | | | | | | | | | | | | systemd-timesyncd will not pick the updated NTP server list in network config until systemd-networkd is reloaded. So if NTPServers are updated in network config, reload networkd, and timesyncd will automatically pick the updated NTP servers. Resolves openbmc/openbmc#2859 Change-Id: I7c01a58d9d1652eee236c8818a41d66eda5b266e Signed-off-by: Lei YU <mine260309@gmail.com>
* Don't handle the ipv6 routing advertisement messageRatan Gupta2018-01-241-0/+1
| | | | | | | | | | | | | In ipv6 network where ipv6 router is there which keeps advertising the router prefix, as part of handling this message BMC keeps adding the new IP address on the interface which is leading to refresh the network objects periodically. This fix stops accepting the router advertisement messaage. Resolves openbmc/openbmc#2739 Change-Id: I0a4068b5419133a25a2ea3f769f730e73860da50 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* return statement is not neededNagaraju Goruganti2017-12-221-1/+0
| | | | | | | | we have updated yaml file to return error code in case of invalid ip/gateway/prefix, no need of return statement now. Change-Id: I9a32e3df12f8f521f5353b011c6a51698bd77403 Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
* ethernet_interface: cleanup whitespace in loggingPatrick Venture2017-12-041-4/+4
| | | | | | | | The log contains a fair amount of extra whitespace, which this addresses. Change-Id: I08a954665803cf9096fe6f3d7539e9e7818b70fa Signed-off-by: Patrick Venture <venture@google.com>
* Add new line character while writing the resolv conf fileRatan Gupta2017-11-161-1/+1
| | | | | Change-Id: I1a02c0050c5a3f1d89664e4b37676a7dbdcf8a56 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Initialize the IP address origin property correctlyRatan Gupta2017-11-141-0/+2
| | | | | | | | | During creation of IP address objects, We determine the ipaddress origin and if the first address is link local then the origin property was not changed for other static addresses. Change-Id: Iacea6393121271327be5c79206492422b5d21a73 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Add DNS supportRatan Gupta2017-11-071-0/+71
| | | | | | | | This commit adds support for enabling user to specify the DNS entries and then updating the resolver file with the same Change-Id: Ib78b822592ea8bdd1f821ccbf1362d96a5021b90 Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
* Spelling fixesGunnar Mills2017-10-261-1/+1
| | | | | Change-Id: I953614024660287b94d835e30b117cc4023e749b Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Enable zeroconf while writing configuration fileNagaraju Goruganti2017-10-121-0/+1
| | | | | | | Resolves openbmc/openbmc#2265 Change-Id: Idf8200fa92d82ee8de4f23e27a2816efae356ea0 Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
* IP Address use case validationNagaraju Goruganti2017-10-111-3/+34
| | | | | | | | | | | -validates IPAddress/gateway using inet_pton api. -validates prefix length for ipv4/ipv6. -if dhcp is enabled, it won't allow to set ip/gateway. Resolves openbmc/openbmc#1671 Change-Id: I76c1d9d11dfb59002eb1310d87e94ee622714a4a Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
* Implement configuration of NTP server supportRatan Gupta2017-10-111-1/+38
| | | | | Change-Id: I8d471dbc6ea7ec62cbcc157565a7b39cd5031caa Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Implement delete all interface.Ratan Gupta2017-10-111-13/+31
| | | | | | | | | deletes all the ipaddress object on the interface. Resolves openbmc/openbmc#2141 Change-Id: I6f045758ff29080cb4a4dec9e8b0d23d932c55b6 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Restart the systemd-networkd after setting the MAC addressRatan Gupta2017-10-031-0/+7
| | | | | | | | | | | | In the case of DHCP enabled box,DHCP negotiation should be initiated after change of MAC address. Shouldn't wait for auto-renegotiation,as if different machine gets the old mac address then we can have duplicate IP problem. Change-Id: Ifde1a09762c9b9a717ffe7b258d5046f92b9bf1a Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Restart the network through networkManagerRatan Gupta2017-10-031-11/+16
| | | | | | | | | | | | | | | Extend the refresh timer once we get the Dbus request which requires network restart. Detaching the network restart from the writeConfiguration func. Write the configuration file for the vlan interface in writeConfiguration func. During creation of vlan,vlan interface should come up with dhcp as false. Change-Id: Iadc7b44554aca412d211d13e9569cc601ad04074 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Don't create the IP objects explicitlyRatan Gupta2017-09-131-6/+1
| | | | | | | | | | | IP objects would be created automatically once network manager detects the address change event. Resolves openbmc/openbmc#2171 Resolves openbmc/openbmc#2258 Change-Id: I2ac26992ac992f25154f0e1bf34c1faf185c4377 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Implement Set function for MAC addressRatan Gupta2017-09-091-8/+70
| | | | | Change-Id: I16992dda259246a66512792f06cbbb874e56a15d Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* DHCP value was not getting updated correctlyRatan Gupta2017-08-311-11/+11
| | | | | | | | | | | | | This commit fixes =>Disable zeroconf. =>Correct the network conf file path in factory reset. =>Updating the DHCP value correctly. Resolves openbmc/openbmc#2230 Resolves openbmc/openbmc#2215 Change-Id: I8f87c2afb53cc952755165d34bfb62b8aba80fe5 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Change the dhcp configuration parameters default value to trueRatan Gupta2017-08-241-1/+2
| | | | | | | | set the link local addressing to yes so that the interface gets the zeroconfig ip, if unable to get the ip from DHCP server. Change-Id: I7e5351662c45863e3d15d49151bfdfb8d9096e11 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* EthernetInterface: Simplify the code to fetch the mac addressRatan Gupta2017-08-131-36/+14
| | | | | Change-Id: I7db6b2379e1794019a8676048ee7dcf3de262a6d Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* vlan:Minor FixesRatan Gupta2017-08-131-3/+9
| | | | | | | | | =>Get the dhcp value from the conf File for the vlan interface. =>Assign the mac address of the parnt interface to vlan interface. =>Create the ipv6 child ip objects once create the vlan interface. Change-Id: I1d73fb18f9d300cbdcf94c73f06df2ea4a1d019b Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* vlan: implement delete interfaceRatan Gupta2017-08-131-1/+52
| | | | | | | | | Delete the in-memory vlan object,Also deletes the associated device file and the network file. Change-Id: I613e31aaa4fa9172c6226765ac044481ffbd88ec Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Load the VLAN interfaces from the systemRatan Gupta2017-08-131-0/+25
| | | | | | | | | At start up Network Manager creates all the interfaces by reading it from the system.This commit creates the vlan interface after reading it from the system. Change-Id: I38e6f3b776f834e33d17e4e88f700b4f52af4048 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Move the implementation for writing conf to interface classRatan Gupta2017-08-131-11/+132
| | | | | | | | implementation of writing interface conf to the ethernet interface class. Change-Id: I279afff45a82ca92c4e50810664f7a7c69a66a61 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Create the VLAN Interface ObjectRatan Gupta2017-08-131-2/+37
| | | | | Change-Id: I118fc4bbcad2a478a8aad976e0619537780c1227 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Implement the Vlan InterfaceRatan Gupta2017-08-131-2/+6
| | | | | Change-Id: I6085868ba4e30bb9e1c6f6d9895a40ebff82804f Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Avoid copying of objectRatan Gupta2017-08-131-1/+1
| | | | | Change-Id: I1e89863344bf6d93b98793c085ea6755f046749f Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Change the pointer type of ip address objectRatan Gupta2017-08-131-14/+13
| | | | | | | | | | | Make the ip address pointer shared as it was declared as shared, but during creation of object it was being created as unique. It is required to be shared as the ip addresses is being exposed through API to network manager. Change-Id: Id520e89b1105dddb7178be638ce708eeeefa5be3 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Refresh the interface objects if DHCP mode changesRatan Gupta2017-06-291-1/+15
| | | | | | | | | | Create the ipaddress objects for the ethernet interface whose DHCP is enabled. Resolves openbmc/openbmc#1295 Change-Id: Id5ad35f1d51f2bf80c4e2b573e7bd38489370411 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Implement system configuration Dbus interfaceRatan Gupta2017-06-211-6/+2
| | | | | Change-Id: I713175e946af47990afcead00558ee4b90cbce8e Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
OpenPOWER on IntegriCloud