networkd-ndisc.c revision a13c50e7a33e2b8e0481f725c6272142e6f71751
9661674ed58ba62a40e43d1a4b38d5e77c3c6545Knut Anders Hatlen/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
9661674ed58ba62a40e43d1a4b38d5e77c3c6545Knut Anders Hatlen This file is part of systemd.
9661674ed58ba62a40e43d1a4b38d5e77c3c6545Knut Anders Hatlen Copyright (C) 2014 Intel Corporation. All rights reserved.
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye systemd is free software; you can redistribute it and/or modify it
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye under the terms of the GNU Lesser General Public License as published by
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye the Free Software Foundation; either version 2.1 of the License, or
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye (at your option) any later version.
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye systemd is distributed in the hope that it will be useful, but
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye WITHOUT ANY WARRANTY; without even the implied warranty of
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye Lesser General Public License for more details.
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye You should have received a copy of the GNU Lesser General Public License
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye along with systemd; If not, see <http://www.gnu.org/licenses/>.
9661674ed58ba62a40e43d1a4b38d5e77c3c6545Knut Anders Hatlenstatic void ndisc_router_handler(sd_ndisc *nd, int event, void *userdata) {
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye case SD_NDISC_EVENT_ROUTER_ADVERTISMENT_TIMEOUT:
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye case SD_NDISC_EVENT_ROUTER_ADVERTISMENT_MANAGED:
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye case SD_NDISC_EVENT_ROUTER_ADVERTISMENT_PREFIX_EXPIRED:
4bb936310d8f131aa850821e9254ac14242c7f95Knut Anders Hatlen log_link_warning_errno(link, event, "IPv6 Neighbor Discover error: %m");
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye log_link_warning(link, "IPv6 Neighbor Discovery unknown event: %d", event);
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye r = sd_ndisc_new(&link->ndisc_router_discovery);
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye r = sd_ndisc_attach_event(link->ndisc_router_discovery, NULL, 0);
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye r = sd_ndisc_set_mac(link->ndisc_router_discovery, &link->mac);
a1318a82916028f363b3c5b52e7fd7256b632497Trond Norbye r = sd_ndisc_set_index(link->ndisc_router_discovery, link->ifindex);