locked
Traffic filter RRS feed

  • Question

  • Hey!

     

    Is this the right place to ask for why this code doesnt blocks all outgoing HTTP traffic like the comments (Havent saved) say?

     

     

    Code Snippet
        PfCreateInterface(0, PF_ACTION_FORWARD, PF_ACTION_FORWARD, FALSE, TRUE, &interfaceHandle);

        BYTE localIp[] = {192,168,0,5};

        PfBindInterfaceToIPAddress(interfaceHandle, PF_IPV4, localIp);

        filter.dwFilterFlags       = FD_FLAGS_NOSYN;
        filter.dwRule              = 0;
        filter.pfatType            = PF_IPV4;
        filter.SrcAddr             = localIp;
        filter.SrcMask             = reinterpret_cast<PBYTE>("\xFF\xFF\xFF\xFF");
        filter.wSrcPort            = FILTER_TCPUDP_PORT_ANY;
        filter.wSrcPortHighRange   = FILTER_TCPUDP_PORT_ANY;
        filter.DstAddr             = 0;
        filter.DstMask             = 0;
        filter.wDstPort            = 80;
        filter.wDstPortHighRange   = 80;
        filter.dwProtocol          = FILTER_PROTO_ANY;

        PfAddFiltersToInterface(interfaceHandle, 1, &filter, 0, 0, &filterHandle);

     

     

    What i am doing wrong?

    Thanks!

    Greets

    Monday, July 2, 2007 11:44 AM

Answers

  • Are you developing on Windows Vista (or Windows Server 2008)?

     

    PFAPIs had been deprecated from these platforms and will no longer function. And WFP is the replacement for it.

     

    Biao.W.

    Wednesday, July 4, 2007 5:46 PM