Changeset 19211


Ignore:
Timestamp:
05/07/12 21:00:27 (14 months ago)
Author:
sash
Message:

ovpn: finish dhcp block

Location:
src/router
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/router/kromo/dd-wrt/lang_pack/english.js

    r18491 r19211  
    13741374service.vpnd_clcon="Client connect script"; 
    13751375service.vpnd_ccddef="CCD-Dir DEFAULT file"; 
     1376service.vpnd_dhcpbl="Block DHCP accross the tunnel"; 
    13761377service.vpn_redirgate="Redirect default Gateway"; 
    13771378service.vpn_legend="OpenVPN Client"; 
  • src/router/openvpn/config2/openvpn.nvramconfig

    r18811 r19211  
    3030 "openvpn_proxy"   "DHCP-Proxy mode" "CHOICE" "2" "0" "1" "FALSE" "0" 
    3131 "openvpn_ccddef"  "OpenVPN ccd dir DEFAULT file"  "NULL"   "FALSE" "0" 
     32 "openvpn_dhcpbl"       "Block DHCP" "CHOICE" "2" "0" "1" "FALSE" "0" 
  • src/router/openvpn/config2/openvpn.webvpn

    r18793 r19211  
    5555                                <div class="setting"> 
    5656                                        <div class="label"><% tran("service.vpnd_mask"); %></div> 
    57                                         <input size="15" maxlength="15" name="openvpn_mask_br" value="<% nvram_get("openvpn_mask"); %>" /> 
    58                                 </div> 
    59                         </div> 
    60                 </div> 
    61  
     57                                        <input size="15" maxlength="15" name="openvpn_mask" value="<% nvram_get("openvpn_mask"); %>" /> 
     58                                </div>           
     59                                <div class="setting"> 
     60                                        <div class="label"><% tran("service.vpnd_dhcpbl"); %></div> 
     61                                        <input class="spaceradio" type="radio" name="openvpn_dhcpbl" value="1" <% nvram_checked("openvpn_dhcpbl", "1"); %> /><% tran("share.enable"); %>&nbsp; 
     62                                        <input class="spaceradio" type="radio" name="openvpn_dhcpbl" value="0" <% nvram_checked("openvpn_dhcpbl", "0"); %> /><% tran("share.disable"); %> 
     63                                </div>                                           
     64                        </div> 
     65                </div> 
    6266                <div class="setting"> 
    6367                        <div class="label"><% tran("share.port"); %></div> 
  • src/router/services/services/openvpn.c

    r19190 r19211  
    177177                        "ebtables -A OUTPUT -o tap2 --pkttype-type multicast -j DROP\n"); 
    178178                //for testing only 
    179 //      if (nvram_match("openvpn_dhcpbl", "1") //block dhcp on bridged vpns 
    180 //              && nvram_match("openvpn_tuntap", "tap") 
    181 //              && nvram_match("openvpn_proxy", "0")) 
     179        if (nvram_match("openvpn_dhcpbl", "1") //block dhcp on bridged vpns 
     180                && nvram_match("openvpn_tuntap", "tap") 
     181                && nvram_match("openvpn_proxy", "0")) 
    182182                fprintf(fp, "insmod ebtables\n" 
    183183                        "insmod ebtable_filter\n" "insmod ebt_ip\n" 
     
    199199                fprintf(fp, "gpio disable %s\n", gpiovpn); 
    200200#endif 
    201         if (nvram_match("openvpn_tuntap", "tap")) { 
     201        if (nvram_match("openvpn_tuntap", "tap"))  
    202202                fprintf(fp, "brctl delif br0 tap2\n" "ifconfig tap2 down\n"); 
    203         } 
    204         if (nvram_match("block_multicast", "0") //block multicast on bridged vpns 
    205                 && nvram_match("openvpn_tuntap", "tap")) 
    206                 fprintf(fp,  
    207                         "ebtables -D FORWARD -o tap2 --pkttype-type multicast -j DROP\n" 
    208                         "ebtables -D OUTPUT -o tap2 --pkttype-type multicast -j DROP\n"); 
    209         if (nvram_match("openvpn_dhcpbl", "1") //block dhcp on bridged vpns 
    210                 && nvram_match("openvpn_tuntap", "tap") 
    211                 && nvram_match("openvpn_proxy", "0")) 
    212                 fprintf(fp, 
    213                         "ebtables -D INPUT -i tap2 --protocol IPv4 --ip-proto udp --ip-sport 67:68 -j DROP\n" 
    214                         "ebtables -D FORWARD -i tap2 --protocol IPv4 --ip-proto udp --ip-sport 67:68 -j DROP\n" 
    215                         "ebtables -D FORWARD -o tap2 --protocol IPv4 --ip-proto udp --ip-sport 67:68 -j DROP\n"); 
    216203        fclose(fp); 
    217204 
     
    247234                eval("stopservice", "wshaper"); 
    248235                eval("startservice", "wshaper"); 
     236                //remove btables rules on shutdown       
     237                sytem("ebtables -D FORWARD -o tap2 --pkttype-type multicast -j DROP\n"); 
     238                sytem("ebtables -D OUTPUT -o tap2 --pkttype-type multicast -j DROP\n");  
     239                sytem("ebtables -D INPUT -i tap2 --protocol IPv4 --ip-proto udp --ip-sport 67:68 -j DROP\n"); 
     240                sytem("ebtables -D FORWARD -i tap2 --protocol IPv4 --ip-proto udp --ip-sport 67:68 -j DROP\n"); 
     241                sytem("ebtables -D FORWARD -o tap2 --protocol IPv4 --ip-proto udp --ip-sport 67:68 -j DROP\n"); 
    249242        } 
    250243 
  • src/router/services/sysinit/defaults.c

    r19210 r19211  
    25212521        {"openvpn_proxy", "0", 0}, 
    25222522        {"openvpn_ccddef", "", 0}, 
     2523        {"openvpn_dhcpbl", "0", 0}, 
    25232524 
    25242525#endif 
Note: See TracChangeset for help on using the changeset viewer.