linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to identify different ip tunnels
@ 2014-01-23  7:33 zhuyj
  2014-01-23  8:54 ` zhuyj
  2014-01-23 18:16 ` Cong Wang
  0 siblings, 2 replies; 3+ messages in thread
From: zhuyj @ 2014-01-23  7:33 UTC (permalink / raw)
  To: David S. Miller, netdev, kuznet, jmorris, yoshfuji, kaber,
	linux-kernel, zhuyj

Hi, Maintainers

We want to identify different ip tunnels.

For example, we use “ip tunnel add xxx” command in linux to create an 
ipv4/6 tunnel interface,then,we can receive a RTM_NEWLINK message from 
linux for the new tunnel interface.
We will parse the struct ifinfomsg message and get the ifi->ifi_type 
attribute. We need to do somethings depend on the tunnel type here.
I checked the linux source code and list all the tunnel types here:

#define ARPHRD_TUNNEL 768 /* IPIP tunnel */
#define ARPHRD_TUNNEL6 769 /* IP6IP6 tunnel */
#define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4 */
#define ARPHRD_IPGRE 778 /* GRE over IP */

It means that the linux will report the new link for any ipv4/6 tunnel 
interface with type only within these four types. However, We need more 
tunnel types for ipv4/6 tunnel.
For example, 4IN4/6IN4/6TO4/GRE/ISATAP for ipv4 tunnel and 
4IN6/6IN6/IPIN6 for ipv6 tunnel.

Here are the result that we have got:

Actual Tunnel type ifi->ifi_type
4IN4 768
GRE4 778
6IN4/6TO4/ISATAP 776
4IN6/6IN6/IPIN6 769

So, we can NOT distinguish the actual tunnel type via ifi_type attribute 
except the GRE4 and 4IN4 tunnel. However we need the actual type. That 
is our question.

BTW, for the 6IN4 and 6TO4 tunnel, Can we distinguish them before the 
interface ip address configured? Because we need to do different things 
for them when we received the new link message and the tunnel has NOT 
any ip address in this time.

Best Regards!
Zhu Yanjun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to identify different ip tunnels
  2014-01-23  7:33 How to identify different ip tunnels zhuyj
@ 2014-01-23  8:54 ` zhuyj
  2014-01-23 18:16 ` Cong Wang
  1 sibling, 0 replies; 3+ messages in thread
From: zhuyj @ 2014-01-23  8:54 UTC (permalink / raw)
  To: David S. Miller, netdev, kuznet, jmorris, yoshfuji, kaber,
	linux-kernel, zhuyj

The version of the kernel is 3.4.43.

Any reply is appreciated.

Best Regards!
Zhu Yanjun
On 01/23/2014 03:33 PM, zhuyj wrote:
> Hi, Maintainers
>
> We want to identify different ip tunnels.
>
> For example, we use “ip tunnel add xxx” command in linux to create an 
> ipv4/6 tunnel interface,then,we can receive a RTM_NEWLINK message from 
> linux for the new tunnel interface.
> We will parse the struct ifinfomsg message and get the ifi->ifi_type 
> attribute. We need to do somethings depend on the tunnel type here.
> I checked the linux source code and list all the tunnel types here:
>
> #define ARPHRD_TUNNEL 768 /* IPIP tunnel */
> #define ARPHRD_TUNNEL6 769 /* IP6IP6 tunnel */
> #define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4 */
> #define ARPHRD_IPGRE 778 /* GRE over IP */
>
> It means that the linux will report the new link for any ipv4/6 tunnel 
> interface with type only within these four types. However, We need 
> more tunnel types for ipv4/6 tunnel.
> For example, 4IN4/6IN4/6TO4/GRE/ISATAP for ipv4 tunnel and 
> 4IN6/6IN6/IPIN6 for ipv6 tunnel.
>
> Here are the result that we have got:
>
> Actual Tunnel type ifi->ifi_type
> 4IN4 768
> GRE4 778
> 6IN4/6TO4/ISATAP 776
> 4IN6/6IN6/IPIN6 769
>
> So, we can NOT distinguish the actual tunnel type via ifi_type 
> attribute except the GRE4 and 4IN4 tunnel. However we need the actual 
> type. That is our question.
>
> BTW, for the 6IN4 and 6TO4 tunnel, Can we distinguish them before the 
> interface ip address configured? Because we need to do different 
> things for them when we received the new link message and the tunnel 
> has NOT any ip address in this time.
>
> Best Regards!
> Zhu Yanjun
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to identify different ip tunnels
  2014-01-23  7:33 How to identify different ip tunnels zhuyj
  2014-01-23  8:54 ` zhuyj
@ 2014-01-23 18:16 ` Cong Wang
  1 sibling, 0 replies; 3+ messages in thread
From: Cong Wang @ 2014-01-23 18:16 UTC (permalink / raw)
  To: zhuyj
  Cc: David S. Miller, netdev, kuznet, jmorris, yoshfuji, kaber, linux-kernel

On Wed, Jan 22, 2014 at 11:33 PM, zhuyj <zyjzyj2000@gmail.com> wrote:
> Here are the result that we have got:
>
> Actual Tunnel type ifi->ifi_type
> 4IN4 768
> GRE4 778
> 6IN4/6TO4/ISATAP 776
> 4IN6/6IN6/IPIN6 769
>
> So, we can NOT distinguish the actual tunnel type via ifi_type attribute
> except the GRE4 and 4IN4 tunnel. However we need the actual type. That is
> our question.

Try to search IFLA_IPTUN_PROTO. They are distinguished by protocol.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-23 18:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-23  7:33 How to identify different ip tunnels zhuyj
2014-01-23  8:54 ` zhuyj
2014-01-23 18:16 ` Cong Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).