On Thu, Dec 10, 2015 at 4:55 AM, Lev Stipakov <lstipa...@gmail.com> wrote:
> +bool > +win_wfp_uninit() > +{ > + dmsg (D_LOW, "Uninitializing WFP"); > + if (m_hEngineHandle) { > + FwpmSubLayerDeleteByKey0(m_hEngineHandle, &m_subLayerGUID); > + CLEAR(m_subLayerGUID); > + FwpmEngineClose0(m_hEngineHandle); > + m_hEngineHandle = NULL; > > > FwpmSubLayerDeleteByKey0 will likely fail if there is a filter > associated with sublayer. On the other side, FwpmEngineClose0 seems to > be enough to remove blocking. > > I think the correct way would be to create GUID for filter same way as > you did for sublayer and copy it to filter.filterKey. In uninit method, > before deleting sublayer you call FwpmFilterDeleteByKey0 with that guid. That sounds useful for yet another reason as well. Its only necessary to delete and recreate the permit filters when the tun restarts. The block filters need be set up only once. Selva