2011年8月25日 星期四

What's bridge-netfilter?


The bridge-netfilter code enables the following functionality:
  • {Ip,Ip6,Arp}tables can filter bridged IPv4/IPv6/ARP packets, even when encapsulated in an 802.1Q VLAN or PPPoE header. This enables the functionality of a stateful transparent firewall.
  • All filtering, logging and NAT features of the 3 tools can therefore be used on bridged frames.
  • Combined with ebtables, the bridge-nf code therefore makes Linux a very powerful transparent firewall.
  • This enables, f.e., the creation of a transparent masquerading machine (i.e. all local hosts think they are directly connected to the Internet).
  • Letting {ip,ip6,arp}tables see bridged traffic can be disabled or enabled using the appropriate proc entries, located in/proc/sys/net/bridge/:
    • bridge-nf-call-arptables
    • bridge-nf-call-iptables
    • bridge-nf-call-ip6tables
    Also, letting the aforementioned firewall tools see bridged 802.1Q VLAN and PPPoE encapsulated packets can be disabled or enabled with a proc entry in the same directory:
    • bridge-nf-filter-vlan-tagged
    • bridge-nf-filter-pppoe-tagged
  • These proc entries are just regular files. Writing '1' to the file (echo 1 > file) enables the specific functionality, while writing a '0' to the file disables it.

sys/utsname.h 平台型號


DESCRIPTION

The  header shall define the structure utsname which shall include at least the following members:
char  sysname[]  Name of this implementation of the operating system. 
char  nodename[] Name of this node within the communications 
                 network to which this node is attached, if any. 
char  release[]  Current release level of this implementation. 
char  version[]  Current version level of this release. 
char  machine[]  Name of the hardware type on which the system is running. 



Example

#include
#include
int main()
{
                struct utsname buf;
                uname (&buf);
                printf ("sysname: %s\n", buf.sysname);
                printf ("nodename: %s\n", buf.nodename);
                printf ("release: %s\n", buf.release);
                printf ("version: %s\n", buf.version);
                printf ("machine: %s\n", buf.machine);
                printf ("domainname: %s\n", buf.__domainname);
                return 0;
}

How to repair and clone disk with ddrescue

  ddrescue  is a tool that can be used to repair and clone disks on a  Linux system . This includes hard drives, partitions, DVD discs, flas...