ip_gre.c (7a085c3aad94cce7e11031c6800e41668418ae4c) ip_gre.c (d0522f1cd25edb796548f91e04766fa3cbc3b6df)
1/*
2 * Linux NET3: GRE over IP protocol decoder.
3 *
4 * Authors: Alexey Kuznetsov (kuznet@ms2.inr.ac.ru)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

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

227 * what the hell these idiots break standards established
228 * by themselves???
229 */
230
231 const struct iphdr *iph = (struct iphdr *)skb->data;
232 const int type = icmp_hdr(skb)->type;
233 const int code = icmp_hdr(skb)->code;
234 struct tnl_ptk_info tpi;
1/*
2 * Linux NET3: GRE over IP protocol decoder.
3 *
4 * Authors: Alexey Kuznetsov (kuznet@ms2.inr.ac.ru)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

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

227 * what the hell these idiots break standards established
228 * by themselves???
229 */
230
231 const struct iphdr *iph = (struct iphdr *)skb->data;
232 const int type = icmp_hdr(skb)->type;
233 const int code = icmp_hdr(skb)->code;
234 struct tnl_ptk_info tpi;
235 bool csum_err = false;
236
235
237 if (gre_parse_header(skb, &tpi, &csum_err, htons(ETH_P_IP),
238 iph->ihl * 4) < 0) {
239 if (!csum_err) /* ignore csum errors. */
240 return;
241 }
236 if (gre_parse_header(skb, &tpi, NULL, htons(ETH_P_IP),
237 iph->ihl * 4) < 0)
238 return;
242
243 if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) {
244 ipv4_update_pmtu(skb, dev_net(skb->dev), info,
239
240 if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) {
241 ipv4_update_pmtu(skb, dev_net(skb->dev), info,
245 skb->dev->ifindex, 0, IPPROTO_GRE, 0);
242 skb->dev->ifindex, IPPROTO_GRE);
246 return;
247 }
248 if (type == ICMP_REDIRECT) {
243 return;
244 }
245 if (type == ICMP_REDIRECT) {
249 ipv4_redirect(skb, dev_net(skb->dev), skb->dev->ifindex, 0,
250 IPPROTO_GRE, 0);
246 ipv4_redirect(skb, dev_net(skb->dev), skb->dev->ifindex,
247 IPPROTO_GRE);
251 return;
252 }
253
254 ipgre_err(skb, info, &tpi);
255}
256
257static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
258 int gre_hdr_len)

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

1599 struct net_device *dev;
1600 LIST_HEAD(list_kill);
1601 struct ip_tunnel *t;
1602 int err;
1603
1604 memset(&tb, 0, sizeof(tb));
1605
1606 dev = rtnl_create_link(net, name, name_assign_type,
248 return;
249 }
250
251 ipgre_err(skb, info, &tpi);
252}
253
254static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
255 int gre_hdr_len)

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

1596 struct net_device *dev;
1597 LIST_HEAD(list_kill);
1598 struct ip_tunnel *t;
1599 int err;
1600
1601 memset(&tb, 0, sizeof(tb));
1602
1603 dev = rtnl_create_link(net, name, name_assign_type,
1607 &ipgre_tap_ops, tb);
1604 &ipgre_tap_ops, tb, NULL);
1608 if (IS_ERR(dev))
1609 return dev;
1610
1611 /* Configure flow based GRE device. */
1612 t = netdev_priv(dev);
1613 t->collect_md = true;
1614
1615 err = ipgre_newlink(net, dev, tb, NULL, NULL);

--- 132 unchanged lines hidden ---
1605 if (IS_ERR(dev))
1606 return dev;
1607
1608 /* Configure flow based GRE device. */
1609 t = netdev_priv(dev);
1610 t->collect_md = true;
1611
1612 err = ipgre_newlink(net, dev, tb, NULL, NULL);

--- 132 unchanged lines hidden ---