ipmr.c (188933ac139a6f8ab06cad369bd0200af947b00d) ipmr.c (b6a7719aedd7e5c0f2df7641aa47386111682df4)
1/*
2 * IP multicast routing support for mrouted 3.6/3.8
3 *
4 * (c) 1995 Alan Cox, <alan@lxorguk.ukuu.org.uk>
5 * Linux Consultancy and Custom Driver Development
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License

--- 59 unchanged lines hidden (view full) ---

68#include <linux/netconf.h>
69
70#if defined(CONFIG_IP_PIMSM_V1) || defined(CONFIG_IP_PIMSM_V2)
71#define CONFIG_IP_PIMSM 1
72#endif
73
74struct mr_table {
75 struct list_head list;
1/*
2 * IP multicast routing support for mrouted 3.6/3.8
3 *
4 * (c) 1995 Alan Cox, <alan@lxorguk.ukuu.org.uk>
5 * Linux Consultancy and Custom Driver Development
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License

--- 59 unchanged lines hidden (view full) ---

68#include <linux/netconf.h>
69
70#if defined(CONFIG_IP_PIMSM_V1) || defined(CONFIG_IP_PIMSM_V2)
71#define CONFIG_IP_PIMSM 1
72#endif
73
74struct mr_table {
75 struct list_head list;
76#ifdef CONFIG_NET_NS
77 struct net *net;
78#endif
76 possible_net_t net;
79 u32 id;
80 struct sock __rcu *mroute_sk;
81 struct timer_list ipmr_expire_timer;
82 struct list_head mfc_unres_queue;
83 struct list_head mfc_cache_array[MFC_LINES];
84 struct vif_device vif_table[MAXVIFS];
85 int maxvif;
86 atomic_t cache_resolve_queue_len;

--- 1552 unchanged lines hidden (view full) ---

1639};
1640
1641/*
1642 * Encapsulate a packet by attaching a valid IPIP header to it.
1643 * This avoids tunnel drivers and other mess and gives us the speed so
1644 * important for multicast video.
1645 */
1646
77 u32 id;
78 struct sock __rcu *mroute_sk;
79 struct timer_list ipmr_expire_timer;
80 struct list_head mfc_unres_queue;
81 struct list_head mfc_cache_array[MFC_LINES];
82 struct vif_device vif_table[MAXVIFS];
83 int maxvif;
84 atomic_t cache_resolve_queue_len;

--- 1552 unchanged lines hidden (view full) ---

1637};
1638
1639/*
1640 * Encapsulate a packet by attaching a valid IPIP header to it.
1641 * This avoids tunnel drivers and other mess and gives us the speed so
1642 * important for multicast video.
1643 */
1644
1647static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr)
1645static void ip_encap(struct net *net, struct sk_buff *skb,
1646 __be32 saddr, __be32 daddr)
1648{
1649 struct iphdr *iph;
1650 const struct iphdr *old_iph = ip_hdr(skb);
1651
1652 skb_push(skb, sizeof(struct iphdr));
1653 skb->transport_header = skb->network_header;
1654 skb_reset_network_header(skb);
1655 iph = ip_hdr(skb);
1656
1657 iph->version = 4;
1658 iph->tos = old_iph->tos;
1659 iph->ttl = old_iph->ttl;
1660 iph->frag_off = 0;
1661 iph->daddr = daddr;
1662 iph->saddr = saddr;
1663 iph->protocol = IPPROTO_IPIP;
1664 iph->ihl = 5;
1665 iph->tot_len = htons(skb->len);
1647{
1648 struct iphdr *iph;
1649 const struct iphdr *old_iph = ip_hdr(skb);
1650
1651 skb_push(skb, sizeof(struct iphdr));
1652 skb->transport_header = skb->network_header;
1653 skb_reset_network_header(skb);
1654 iph = ip_hdr(skb);
1655
1656 iph->version = 4;
1657 iph->tos = old_iph->tos;
1658 iph->ttl = old_iph->ttl;
1659 iph->frag_off = 0;
1660 iph->daddr = daddr;
1661 iph->saddr = saddr;
1662 iph->protocol = IPPROTO_IPIP;
1663 iph->ihl = 5;
1664 iph->tot_len = htons(skb->len);
1666 ip_select_ident(skb, NULL);
1665 ip_select_ident(net, skb, NULL);
1667 ip_send_check(iph);
1668
1669 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
1670 nf_reset(skb);
1671}
1672
1673static inline int ipmr_forward_finish(struct sk_buff *skb)
1674{

--- 80 unchanged lines hidden (view full) ---

1755 skb_dst_drop(skb);
1756 skb_dst_set(skb, &rt->dst);
1757 ip_decrease_ttl(ip_hdr(skb));
1758
1759 /* FIXME: forward and output firewalls used to be called here.
1760 * What do we do with netfilter? -- RR
1761 */
1762 if (vif->flags & VIFF_TUNNEL) {
1666 ip_send_check(iph);
1667
1668 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
1669 nf_reset(skb);
1670}
1671
1672static inline int ipmr_forward_finish(struct sk_buff *skb)
1673{

--- 80 unchanged lines hidden (view full) ---

1754 skb_dst_drop(skb);
1755 skb_dst_set(skb, &rt->dst);
1756 ip_decrease_ttl(ip_hdr(skb));
1757
1758 /* FIXME: forward and output firewalls used to be called here.
1759 * What do we do with netfilter? -- RR
1760 */
1761 if (vif->flags & VIFF_TUNNEL) {
1763 ip_encap(skb, vif->local, vif->remote);
1762 ip_encap(net, skb, vif->local, vif->remote);
1764 /* FIXME: extra output firewall step used to be here. --RR */
1765 vif->dev->stats.tx_packets++;
1766 vif->dev->stats.tx_bytes += skb->len;
1767 }
1768
1769 IPCB(skb)->flags |= IPSKB_FORWARDED;
1770
1771 /*

--- 1011 unchanged lines hidden ---
1763 /* FIXME: extra output firewall step used to be here. --RR */
1764 vif->dev->stats.tx_packets++;
1765 vif->dev->stats.tx_bytes += skb->len;
1766 }
1767
1768 IPCB(skb)->flags |= IPSKB_FORWARDED;
1769
1770 /*

--- 1011 unchanged lines hidden ---