English 中文(简体)
How to modify struct sk_buff
原标题:

I have to write a vpn module. First of all, I have wrote a kernel module that modifies all the incoming and outgoing TCP packets. It uses netfilter hooks. For the incoming packets, I have modified the bytes between (struct sk_buff)->data and (struct sk_buff)->tail pointers by incrementing them by one. For the outgoing packets, I have modified the bytes between (struct sk_buff)->data and (struct sk_buff)->tail pointers by decrementing them by one.

However, I tried to establish a TCP connection between localhost and localhost (by means of netcat) and I had not succeeded. Can you tell me what I am doing wrong? Need I modify some other fields from the struct sk_buff structure?


Is it possible to implement my simple vpn module only from kernel space?(thus without using special libraies such as libnetfilter_queue)?

Thank you.

问题回答

Yes, you can do this without using libnetfilter. But given the limited information that you ve provided about your project it s hard to give a good recommendation as to how to go about fixing your issue. Here s some references that should help.

1) I would recommend you take a look at the TUN/TAP interface driver APIs. This will allow you to implement your code in application space rather than kernel. See openvpn for a great example of this type of VPN.

If you re interested in doing more advanced kernel space hooking...
2) Check this article out on hooking into netfilter netfilter kernel hooks





相关问题
vpn connection and ip problem

i have one application who use to connect to server via VPN. i can put server name or Ip in application to connect to server. If i put IP & Connect to VPN (this work fine except if any other ...

iPhone - Send VPN traffic for a specific URL

I am building a iPhone web based app for our execs to view sales data. The app goes over SSL with a typical login page that sets a cookie for the day. Since the info is sensitive and we have a VPN at ...

SQL Server VPN Replication

I have a requirement to use Sql replication from a sql server 2005 instance to a Sql 2000 instance over a vpn. The vpn is permanent between the 2 sites and there are only a few tables that need ...

How to modify struct sk_buff

I have to write a vpn module. First of all, I have wrote a kernel module that modifies all the incoming and outgoing TCP packets. It uses netfilter hooks. For the incoming packets, I have modified the ...

How do odbc (or mysql) resources work in php?

When you run a query like so: $query = "SELECT * FROM table"; $result = odbc_exec($dbh, $query); while ($row = odbc_fetch_array($result)) { print_r($row); } Does the resource stored in $result ...

How to Get the current VPN Windows Identity

I have a console application that calls a WCF service on a remote domain. The WCF service is uses Windows credential type for the transport and message credential types. The WCF service is ...

热门标签