diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-06-03 15:33:52 +0200 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-07-30 10:41:51 +0200 |
commit | a90fb5a6369ffb1413994110689ea6ecec2961df (patch) | |
tree | e794466c704b795b560a6df09c6d6cdd46f1719d | |
parent | 3d22f2b38b68683d0d76916e571f7a5b92ec8880 (diff) |
pppoe2 compatibility: rename wan rsppp0 -> ppp00.3.2
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/main.rs | 30 |
3 files changed, 18 insertions, 16 deletions
@@ -390,7 +390,7 @@ checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" [[package]] name = "rsdsl_netfilterd" -version = "0.3.1" +version = "0.3.2" dependencies = [ "failure", "rustables", @@ -1,6 +1,6 @@ [package] name = "rsdsl_netfilterd" -version = "0.3.1" +version = "0.3.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index 4cdd1d7..063a98d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,8 @@ use rsdsl_netfilterd::error::Result; +use std::thread; +use std::time::Duration; + use rustables::{ Batch, Chain, ChainPolicy, ChainType, Hook, HookClass, MsgType, Protocol, ProtocolFamily, Rule, Table, @@ -23,7 +26,7 @@ fn nat() -> Result<()> { batch.add(&postrouting, MsgType::Add); - let rule = Rule::new(&postrouting)?.oface("rsppp0")?.masquerade(); + let rule = Rule::new(&postrouting)?.oface("ppp0")?.masquerade(); batch.add(&rule, MsgType::Add); // +------------------+ @@ -40,7 +43,7 @@ fn nat() -> Result<()> { for port in 5060..=5080 { let dnat_sip = Rule::new(&prerouting)? - .iface("rsppp0")? + .iface("ppp0")? .dport(port, Protocol::UDP) .dnat("10.128.40.252".parse()?, None); batch.add(&dnat_sip, MsgType::Add); @@ -48,7 +51,7 @@ fn nat() -> Result<()> { for port in 16384..=16482 { let dnat_rtp = Rule::new(&prerouting)? - .iface("rsppp0")? + .iface("ppp0")? .dport(port, Protocol::UDP) .dnat("10.128.40.252".parse()?, None); batch.add(&dnat_rtp, MsgType::Add); @@ -88,7 +91,7 @@ fn filter() -> Result<()> { let allow_6in4 = Rule::new(&input)?.ip6in4().accept(); batch.add(&allow_6in4, MsgType::Add); - let deny_wan4 = Rule::new(&input)?.iface("rsppp0")?.drop(); + let deny_wan4 = Rule::new(&input)?.iface("ppp0")?.drop(); batch.add(&deny_wan4, MsgType::Add); let deny_wan6 = Rule::new(&input)?.iface("he6in4")?.drop(); @@ -137,7 +140,7 @@ fn filter() -> Result<()> { batch.add(&deny_any_to_isolated, MsgType::Add); let clamp_mss_inbound4 = Rule::new(&forward)? - .iface("rsppp0")? + .iface("ppp0")? .protocol(Protocol::TCP) .syn()? .clamp_mss_to_pmtu(); @@ -151,7 +154,7 @@ fn filter() -> Result<()> { batch.add(&clamp_mss_inbound6, MsgType::Add); let clamp_mss_outbound4 = Rule::new(&forward)? - .oface("rsppp0")? + .oface("ppp0")? .protocol(Protocol::TCP) .syn()? .clamp_mss_to_pmtu(); @@ -167,10 +170,7 @@ fn filter() -> Result<()> { let allow_established = Rule::new(&forward)?.established()?.accept(); batch.add(&allow_established, MsgType::Add); - let allow_mgmt_to_wan4 = Rule::new(&forward)? - .iface("eth0")? - .oface("rsppp0")? - .accept(); + let allow_mgmt_to_wan4 = Rule::new(&forward)?.iface("eth0")?.oface("ppp0")?.accept(); batch.add(&allow_mgmt_to_wan4, MsgType::Add); let allow_mgmt_to_wan6 = Rule::new(&forward)? @@ -181,7 +181,7 @@ fn filter() -> Result<()> { let allow_trusted_to_wan4 = Rule::new(&forward)? .iface("eth0.10")? - .oface("rsppp0")? + .oface("ppp0")? .accept(); batch.add(&allow_trusted_to_wan4, MsgType::Add); @@ -193,7 +193,7 @@ fn filter() -> Result<()> { let allow_untrusted_to_wan4 = Rule::new(&forward)? .iface("eth0.20")? - .oface("rsppp0")? + .oface("ppp0")? .accept(); batch.add(&allow_untrusted_to_wan4, MsgType::Add); @@ -205,7 +205,7 @@ fn filter() -> Result<()> { let allow_exposed_to_wan4 = Rule::new(&forward)? .iface("eth0.40")? - .oface("rsppp0")? + .oface("ppp0")? .accept(); batch.add(&allow_exposed_to_wan4, MsgType::Add); @@ -245,5 +245,7 @@ fn main() -> Result<()> { } } - Ok(()) + loop { + thread::sleep(Duration::MAX); + } } |