Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddAddress4 not setting the new IP #2

Merged
merged 1 commit into from Feb 2, 2016

Conversation

causten
Copy link
Member

@causten causten commented Feb 2, 2016

Just a few changes to make it work...

  1. Ensure the .network file is a known name. It must be
    deleted before the new .network file is added since
    the other file also had the same interface and priority level
  2. I got on the systemd channel because restarting the systemd
    service does not change the ip address. You needed to
    flush the ip instead.

Notes on the networkd subject from the IRC channel...
From the systemd-networkd manpage... "Network configurations applied
before networkd is started are not removed"

I also learned from the IRC to use the 'ip addr flush ' to
force the network cleanup. ...

<causten__> danderson, so if I setup a server on one subnet, rebooted, then wanted to change the ip I couldn't do it without rebooting?
<causten__> is there a workaround? I mean switching ips in a lab to a different subnet is common
either that, or manually clean up the interface configuration before restarting networkd
i.e. ip addr del 1.2.3.4 dev eno1 or whatever
alternatively, you may want to just use a different network configuration manager (e.g. arch's netctl, or network-manager), if your use case is more complex
networkd is by design aimed at one-time configuration on startup, and minor maintenance like keeping DHCP going

Just a few changes to make it work...

1) Ensure the .network file is a known name.  It must be
   deleted before the new .network file is added since
   the other file also had the same interface and priority level
2) I got on the systemd channel because restarting the systemd
   service does not change the ip address.  You needed to
   flush the ip instead.

Notes on the networkd subject from the IRC channel...
From the systemd-networkd manpage... "Network configurations applied
 before networkd is started are not removed"

I also learned from the IRC to use the 'ip addr flush <device>' to
force the network cleanup.  ...

<causten__> danderson, so if I setup a server on one subnet, rebooted, then wanted to change the ip I couldn't do it without rebooting?
<causten__> is there a workaround?  I mean switching ips in a lab to a different subnet is common
<danderson> either that, or manually clean up the interface configuration before restarting networkd
<danderson> i.e. `ip addr del 1.2.3.4 dev eno1` or whatever
<danderson> alternatively, you may want to just use a different network configuration manager (e.g. arch's netctl, or network-manager), if your use case is more complex
<danderson> networkd is by design aimed at one-time configuration on startup, and minor maintenance like keeping DHCP going
nkskjames added a commit that referenced this pull request Feb 2, 2016
AddAddress4 not setting the new IP
@nkskjames nkskjames merged commit 437f233 into openbmc:master Feb 2, 2016
amboar added a commit to amboar/phosphor-networkd that referenced this pull request Mar 7, 2018
We were hitting a SEGFAULT by nullptr dereference in the WithSingleInterface
test when calling sd_bus_ref() via the timer callback with code generated at
-O2 from Ubuntu Artful's gcc-7.2.0:

Running main() from gtest_main.cc
Note: Google Test filter = TestRtNetlink.WithSingleInterface
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from TestRtNetlink
[ RUN      ] TestRtNetlink.WithSingleInterface
ASAN:DEADLYSIGNAL
=================================================================
==19427==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f8a944922ca bp 0x0fffd7e37fc2 sp 0x7ffebf1bfda8 T0)
==19427==The signal is caused by a READ memory access.
==19427==Hint: address points to the zero page.
    #0 0x7f8a944922c9 in sd_bus_ref (/lib/x86_64-linux-gnu/libsystemd.so.0+0x2e2c9)
    openbmc#1 0x7f8a93a5c616 in sdbusplus::bus::bus::bus(sd_bus*) /usr/local/include/sdbusplus/bus.hpp:340
    openbmc#2 0x7f8a93a5c616 in sdbusplus::server::interface::interface::interface(sdbusplus::bus::bus&, char const*, char const*, sd_bus_vtable const*, void*) /usr/local/include/sdbusplus/server/interface.hpp:61
...
    openbmc#16 0x559d611755e7 in phosphor::network::Manager::createInterfaces() ../network_manager.cpp:151
    openbmc#17 0x559d61178e12 in phosphor::network::Manager::createChildObjects() ../network_manager.cpp:166
    openbmc#18 0x559d611ed59b in std::function<void ()>::operator()() const /usr/include/c++/7/bits/std_function.h:706
    openbmc#19 0x559d611ed59b in phosphor::network::Timer::timeoutHandler(sd_event_source*, unsigned long, void*) ../timer.cpp:72
    openbmc#20 0x7f8a9448e80d  (/lib/x86_64-linux-gnu/libsystemd.so.0+0x2a80d)
    openbmc#21 0x7f8a944903e9 in sd_event_dispatch (/lib/x86_64-linux-gnu/libsystemd.so.0+0x2c3e9)
    openbmc#22 0x7f8a94490566 in sd_event_run (/lib/x86_64-linux-gnu/libsystemd.so.0+0x2c566)
    openbmc#23 0x559d610e122e in phosphor::network::TestRtNetlink_WithSingleInterface_Test::TestBody() /tmp/openbmc-build-scripts.wUcrvx/phosphor-networkd/test/test_rtnetlink.cpp:135
...

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libsystemd.so.0+0x2e2c9) in sd_bus_ref
==19427==ABORTING

Move the bus storage to namespace scope alongside the Manager to avoid it
getting cleaned up before the callback fires.

Change-Id: I3126d0b7b92fb6e66d82f9e32b43a52e44356884
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
geissonator pushed a commit that referenced this pull request Mar 15, 2018
We were hitting a SEGFAULT by nullptr dereference in the WithSingleInterface
test when calling sd_bus_ref() via the timer callback with code generated at
-O2 from Ubuntu Artful's gcc-7.2.0:

Running main() from gtest_main.cc
Note: Google Test filter = TestRtNetlink.WithSingleInterface
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from TestRtNetlink
[ RUN      ] TestRtNetlink.WithSingleInterface
ASAN:DEADLYSIGNAL
=================================================================
==19427==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f8a944922ca bp 0x0fffd7e37fc2 sp 0x7ffebf1bfda8 T0)
==19427==The signal is caused by a READ memory access.
==19427==Hint: address points to the zero page.
    #0 0x7f8a944922c9 in sd_bus_ref (/lib/x86_64-linux-gnu/libsystemd.so.0+0x2e2c9)
    #1 0x7f8a93a5c616 in sdbusplus::bus::bus::bus(sd_bus*) /usr/local/include/sdbusplus/bus.hpp:340
    #2 0x7f8a93a5c616 in sdbusplus::server::interface::interface::interface(sdbusplus::bus::bus&, char const*, char const*, sd_bus_vtable const*, void*) /usr/local/include/sdbusplus/server/interface.hpp:61
...
    #16 0x559d611755e7 in phosphor::network::Manager::createInterfaces() ../network_manager.cpp:151
    #17 0x559d61178e12 in phosphor::network::Manager::createChildObjects() ../network_manager.cpp:166
    #18 0x559d611ed59b in std::function<void ()>::operator()() const /usr/include/c++/7/bits/std_function.h:706
    #19 0x559d611ed59b in phosphor::network::Timer::timeoutHandler(sd_event_source*, unsigned long, void*) ../timer.cpp:72
    #20 0x7f8a9448e80d  (/lib/x86_64-linux-gnu/libsystemd.so.0+0x2a80d)
    #21 0x7f8a944903e9 in sd_event_dispatch (/lib/x86_64-linux-gnu/libsystemd.so.0+0x2c3e9)
    #22 0x7f8a94490566 in sd_event_run (/lib/x86_64-linux-gnu/libsystemd.so.0+0x2c566)
    #23 0x559d610e122e in phosphor::network::TestRtNetlink_WithSingleInterface_Test::TestBody() /tmp/openbmc-build-scripts.wUcrvx/phosphor-networkd/test/test_rtnetlink.cpp:135
...

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libsystemd.so.0+0x2e2c9) in sd_bus_ref
==19427==ABORTING

Move the bus storage to namespace scope alongside the Manager to avoid it
getting cleaned up before the callback fires.

Change-Id: I3126d0b7b92fb6e66d82f9e32b43a52e44356884
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants