void wlanRegisterNotifier(void) { register_inetaddr_notifier(&inetaddr_notifier); #if 0 //CFG_SUPPORT_PASSPOINT register_inet6addr_notifier(&inet6addr_notifier); #endif /* CFG_SUPPORT_PASSPOINT */ }
int brcmf_bus_start(struct device *dev) { int ret = -1; struct brcmf_bus *bus_if = dev_get_drvdata(dev); struct brcmf_pub *drvr = bus_if->drvr; struct brcmf_if *ifp; struct brcmf_if *p2p_ifp; brcmf_dbg(TRACE, "\n"); /* add primary networking interface */ ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", NULL); if (IS_ERR(ifp)) return PTR_ERR(ifp); p2p_ifp = NULL; /* signal bus ready */ brcmf_bus_change_state(bus_if, BRCMF_BUS_UP); /* Bus is ready, do any initialization */ ret = brcmf_c_preinit_dcmds(ifp); if (ret < 0) goto fail; brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read); /* assure we have chipid before feature attach */ if (!bus_if->chip) { bus_if->chip = drvr->revinfo.chipnum; bus_if->chiprev = drvr->revinfo.chiprev; brcmf_dbg(INFO, "firmware revinfo: chip %x (%d) rev %d\n", bus_if->chip, bus_if->chip, bus_if->chiprev); } brcmf_feat_attach(drvr); ret = brcmf_fws_init(drvr); if (ret < 0) goto fail; brcmf_fws_add_interface(ifp); drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev, drvr->settings->p2p_enable); if (drvr->config == NULL) { ret = -ENOMEM; goto fail; } ret = brcmf_net_attach(ifp, false); if ((!ret) && (drvr->settings->p2p_enable)) { p2p_ifp = drvr->iflist[1]; if (p2p_ifp) ret = brcmf_net_p2p_attach(p2p_ifp); } if (ret) goto fail; #ifdef CONFIG_INET drvr->inetaddr_notifier.notifier_call = brcmf_inetaddr_changed; ret = register_inetaddr_notifier(&drvr->inetaddr_notifier); if (ret) goto fail; #if IS_ENABLED(CONFIG_IPV6) drvr->inet6addr_notifier.notifier_call = brcmf_inet6addr_changed; ret = register_inet6addr_notifier(&drvr->inet6addr_notifier); if (ret) { unregister_inetaddr_notifier(&drvr->inetaddr_notifier); goto fail; } #endif #endif /* CONFIG_INET */ return 0; fail: brcmf_err("failed: %d\n", ret); if (drvr->config) { brcmf_cfg80211_detach(drvr->config); drvr->config = NULL; } if (drvr->fws) { brcmf_fws_del_interface(ifp); brcmf_fws_deinit(drvr); } if (ifp) brcmf_net_detach(ifp->ndev, false); if (p2p_ifp) brcmf_net_detach(p2p_ifp->ndev, false); drvr->iflist[0] = NULL; drvr->iflist[1] = NULL; if (drvr->settings->ignore_probe_fail) ret = 0; return ret; }
Boolean ssh_interceptor_iface_init(SshInterceptor interceptor) { SSH_ASSERT(!in_softirq()); /* This will register notifier that notifies about bringing the interface up and down. */ interceptor->nf->notifier_netdev.notifier_call = ssh_interceptor_notifier_callback; interceptor->nf->notifier_netdev.priority = 1; interceptor->nf->notifier_netdev.next = NULL; register_netdevice_notifier(&interceptor->nf->notifier_netdev); /* This will register notifier that notifies when address of the interface changes without bringing the interface down. */ interceptor->nf->notifier_inetaddr.notifier_call = ssh_interceptor_notifier_callback; interceptor->nf->notifier_inetaddr.priority = 1; interceptor->nf->notifier_inetaddr.next = NULL; register_inetaddr_notifier(&interceptor->nf->notifier_inetaddr); #ifdef SSH_LINUX_INTERCEPTOR_IPV6 interceptor->nf->notifier_inet6addr.notifier_call = ssh_interceptor_notifier_callback; interceptor->nf->notifier_inet6addr.priority = 1; interceptor->nf->notifier_inet6addr.next = NULL; register_inet6addr_notifier(&interceptor->nf->notifier_inet6addr); #endif /* SSH_LINUX_INTERCEPTOR_IPV6 */ interceptor->nf->iface_notifiers_installed = TRUE; /* Send interface information to engine. This causes the interceptor to grab reference to each net_device. On error cases ssh_interceptor_clear_ifaces() or ssh_interceptor_iface_uninit() must be called to release the references. */ ssh_interceptor_receive_ifaces(interceptor); return TRUE; }