title: Redirect per-app DNS requests at the ALE_CONNECT_REDIRECT_V4 layer using WFP
body: <p>I am trying to redirect DNS requests on a per-app basis using WFP (Windows Filtering Platform). I want to redirect to a public DNS server - not a local proxy. I have a callout driver at the <code>ALE_CONNECT_REDIRECT_V4</code> layer. When I trace DNS requests at this layer, i can see them going out just fine.</p>
  <p>However, when i rewrite the DNS server ip (using <code>INETADDR_SET_ADDRESS</code>) to another public server such as <code>1.1.1.1</code> (i'm only rewriting to public servers, not a local proxy) I see the rewritten DNS requests leaving on wireshark and also their responses coming in, successfully -- yet the application whose DNS i'm rewriting does not receive those DNS responses - it fails to resolve the hostname.</p>
  <p>I have disabled the DNS cache so that the DNS requests come directly from the application, rather than the svchost.exe process.</p>
  <p>Why is this? Do I have to somehow also hook incoming packets and restore the DNS server to the one the application expects? I'm at a loss.</p>