datasource/Cached_Content_Loader: added caching content loader
[metux-java.git] / ip / IPIP_Device.java
blobb769a995b6946e4276426296d2b8dddf673805aa
2 package org.de.metux.ip;
4 import org.de.metux.util.Exec;
5 import java.net.UnknownHostException;
7 public class IPIP_Device
9 String if_name;
11 public IPIP_Device(String name)
13 if_name = name;
16 public boolean delete()
18 return Exec.exec_command("ifconfig "+if_name+" down") &&
19 Exec.exec_command("ip tunnel del "+if_name);
22 // fixme: protect interface name !
23 public boolean add(
24 String local_addr,
25 String remote_addr)
26 throws UnknownHostException
29 String cmdline =
30 "ip tunnel add "+if_name+
31 " mode ipip local "+Lookup.getIP_str(local_addr)+
32 " remote "+Lookup.getIP_str(remote_addr)
35 System.err.println("IPIP::add executing: "+cmdline);
36 return Exec.exec_command(cmdline);
39 public boolean configureIP(
40 String address,
41 String netmask,
42 int mtu
44 throws UnknownHostException
46 return Exec.exec_command(
47 "ifconfig "+if_name+
48 " inet "+Lookup.getIP_str(address)+
49 " netmask "+netmask+
50 " mtu "+mtu);