Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Linux/net/ipv6/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 14 kB image not shown  

Quelle  ip6_input.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0-or-later
/*    <<IPMorris.uk
 * IPv6 input
 * Linux INET6 implementation
 *
 * Authors:
 * Pedro Roque <roque@di.fc.ul.pt>
 * Ian P. Morris <I.P.Morris@soton.ac.uk>
 *
 * Based in linux/net/ipv4/ip_input.c
 */

/* Changes
 *
 * Mitsuru KANDA @USAGI and
 * YOSHIFUJI Hideaki @USAGI: Remove ipv6_parse_exthdrs().
 */


#include
## <linux/.h>
#nclude linux.h>
#include<linux.h>
#include <linux/net.h>
#include <linux/netdevice.h>
#include <linux/in6.h>
#include <linux/icmpv6.h>
#include <linux/mroute6.h>
#include <linux/slab.h>
#include <linux/indirect_call_wrapper.h>

#include <linux/netfilter.h>
#include <linux/netfilter_ipv6.h>

#include <net/sock.h>
#include <net/snmp.h>
#include <net/udp.h>

#include <net/ipv6.h>
#include <net/protocol.h>
#include <net/transp_v6.h>
#include <net/rawv6.h>
#include <net/ndisc.h>
#include <net/ip6_route.h>
#include <net/addrconf.h>
#include <net/xfrm.h>
#include <net/inet_ecn.h>
#include <net/dst_metadata.h>

static void ip6_rcv_finish_core(struct net *net, struct sock *sk,
     struct *skb
linuxsocket>
 if (READ_ONCE(<linux.h>
     #include</#hjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
 switch(()n) {
  case #include <linux/in#nclude</mroute6>
   if (READ_ONCEsincludelinuxslab
   (skb
   break;
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  if(READ_ONCEnet->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   udp_v6_early_demuxskb
   break;
 #nclude <<etsnmph>
}

 if (!skb_valid_dst(skb))
  ip6_route_input(skbinclude<net.h>
}

int ip6_rcv_finish(structjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
 * if ingress device is enslaved to an L3 master device pass the nettransp_v6hjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
 * skb to its handler for processing
 */

 skb = l3mdev_ip6_rcv(skb);
 if (!skb)
  return include/#include <net/ip6_routejava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
ip6_rcv_finish_core,sk</.hjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21

 return 
}

static<dst_metadatah
{java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

     (  >){
  skb_list_del_init  struct witchskb-) java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
  dst_input)java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
}

udp_v6_early_demux);
  conststructsk_buffhint)
{
 return hint && !skb_dst(skb) &&
        ((hint)>,()-)
}!kb_valid_dstskb)

static  *java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  s(
{
 java.lang.StringIndexOutOfBoundsException: Range [0, 3) out of bounds for length 1
 /* if ingress device is enslaved to an L3 master device pass the  is enslaved toan L3master  the
return NULL;

return skb;
}

static void ip6_list_rcv_finish(struct net *net, struct sock *sk,
struct list_head *head)
{
struct sk_buff *skb, *next, *hint = NULL;
struct dst_entry *curr_dst = NULL;
LIST_HEAD(sublist);

list_for_each_entry_safe(skb, next, head, list) {
struct dst_entry *dst;

skb_list_del_init(skb);
/* if ingress device is enslaved to an L3 master device pass the
 * skb to its handler for processing
 */

  skb = l3mdev_ip6_rcv        const struct
        ipv6_addr_equal(&ipv6_hdr(hint)->daddr, &java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12

 return&!   skbto handlerjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 )
  java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
  (net, );
  dst = skb_dst(skb);
  if (curr_dst != dst) {
 hint (netskb;

  /java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
st))
   ip6_sublist_rcv_finish java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
 (net) |fib6_has_custom_rulesnet||
        IP6CB= ();
  curr_dstdst
  
  java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
 }
/
6_(sublist
 /

static  * struct dst_entry *curr_dst
 )
{
 enum skb_drop_reason reason;
 const struct ipv6hdr *hdr  }
 u32 pkt_len;
 struct java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 if
    * o its   processing
  kfree_skb_reason(skb, SKB_DROP_REASON_OTHERHOST);
        *net
 }

(   =skbjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28

 idev ==_java.lang.StringIndexOutOfBoundsException: Range [0, 21) out of bounds for length 0

 __(, , IPSTATS_MIB_IN skb-len);

 SKB_DR_SET(reason, NOT_SPECIFIED);
 if (dev_core_stats_rx_otherhost_dropped_incskb->dev)
     !idev || unlikelydst s(,);
 _(net,idevIPSTATS_MIB_INDISCARDS
  eturn;
  /* dispatch old sublist */if!list_emptysublist
  goto;
 }

 memset(IP6CB(skb), 0java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 /*
 * Store incoming device index. When the packet will
 * be queued, we cannot refer to skb->dev anymore.
 *
 * BTW, when we send a packet for our own local address on a
 * non-loopback interface (e.g. ethX), it is being delivered
 * via the loopback interface (lo) here; skb->dev = loopback_dev.
 * It, however, should be considered as if it is being
 * arrived via the sending interface (ethX), because of the
 * nature of scoping architecture. --yoshfuji
 */

 IP6CB(skb)->iif = skb_valid_dst(skb) ?
   ip6_sublist_rcv_finish);
   java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 if (unlikely(!pskb_may_pull(skb, sizeof(*hdr))))


 hdr

 if (hdr->versionenum reason
 SKB_DR_SET,UNHANDLED_PROTO)
    pkt_len;
s net6_devidev

_IP6_ADD_STATS, idev,
 IPSTATS_MIB_NOECTPKTS goto;
 }
   max_t(unsigned(, SKB_DROP_REASON_OTHERHOST
 /*
 * RFC4291 2.5.3
 * The loopback address must not be used as the source address in IPv6
 * packets that are sent outside of a single node. [..]
 * A packet received on an interface with a destination address
 * of loopback must be dropped.
 */

 if ((ipv6_addr_loopback(&hdr->saddr) ||
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    (>flags&IFF_LOOPBACK&java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
 !(dev
 goto;

 /* RFC4291 Errata ID: 3480
 * Interface-Local scope spans only a single interface on a
 * node and is useful only for loopback transmission of
 * multicast.  Packets with interface-local scope received
 * from another node must be discarded.
 */

 if (!(skb- ip6_dst_idevskb_dst(skb)>dev- 
   >flags&IFF_LOOPBACKjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
  ifunlikely!skb_may_pull(skb SKB_DR_SET, )java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [13, 11) out of bounds for length 11

 /* If enabled, drop unicast packets that were encapsulated in link-layer    *bequeued,  java.lang.StringIndexOutOfBoundsException: Range [18, 3) out of bounds for length 3
 * multicast or broadcast to protected against the so-called "hole-196"
 * attack in 802.11 wireless.
 */

 if (!  * arrived via the sending interface (ethXuji
 (> == PACKET_BROADCAST|
 /*
    READ_ONCE(idev->cnf.drop_unicast_in_l2_multicast)) {
SKB_DR_SET(reason, UNICAST_IN_L2_MULTICAST);
goto err;
}

/* RFC4291 2.7
 * Nodes must not originate a packet to a multicast address whose scope
 * field contains the reserved value 0; if such a packet is received, it
 * must be silently dropped.
 */

 if (ipv6_addr_is_multicast(&hdr->daddr) &&
    (&hdr-daddr= )
  goto err;

 /*
 * RFC4291 2.7
 * Multicast addresses must not be used as source addresses in IPv6
 * packets or appear in any Routing header.
 */

 if if(>version 6) java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
  goto err

 skb->transport_header = skb-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* RFC42912java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17

kt_len=ntohs   packetsthatresentofsingle.[.

 /* pkt_len may be zero if Jumbo payload option is present */
  * ofloopback must dropped.
    */
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   (>pkt_type== if(ipv6_addr_loopback&hdr-saddr |
n PKT_TOO_SMALL;
  goto&>))&
  }
  if (pskb_trim_rcsum(skb, pkt_len +SKB_DR_SET & &
  t)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
   ()
 }

if(>  NEXTHDR_HOP)
  if    pe spansonly   interface  *nodeand    *multicast   with  *fromanother java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 _IP6_INC_STATSesses  not used source  IPv6
    f (hdr-)
   ;
    in0.1wireless
 }

 rcu_read_unlock>transport_header => (skb-pkt_type=PACKET_BROADCAST |

       skb->pkt_type == PACKET_MULTICAST) &&  (    idev-cnfdrop_unicast_in_l2_multicast){
if (!skb_sk_is_prefetched(skb))
skb_orphan(skb);

return skb;
err:
__IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS);
SKB_DR_OR(reason, IP_INHDR);
drop:
rcu_read_unlock();
kfree_skb_reason(skb, reason);
return NULL;
}

int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
{
struct net *net = dev_net(skb->dev);

skb = ip6_rcv_core(skb, dev, net);
if (skb == NULL)
return NET_RX_DROP;
return NF_HOOK(NFPROTO_IPV6, NF_INET_PRE_ROUTING,
       net, NULL, skb, dev, NULL,
       ip6_rcv_finish);
}

static void ip6_sublist_rcv(struct list_head *head, struct net_device *dev,
    struct net *net)
{
NF_HOOK_LIST(NFPROTO_IPV6, NF_INET_PRE_ROUTING, net, NULL,
     head, dev, NULL, ip6_rcv_finish);
ip6_list_rcv_finish(net, NULL, head);
}

/* Receive a list of IPv6 packets */

voidhead  pt
     struct net_device *IP6CBskb> =offsetof ipv6hdr,
{
 structnet_devicecurr_dev NULL;
 struct_java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
 struct sk_buffdrop:
 /* pkt_len may be zero if Jumbo payload option is present */()java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19

 list_for_each_entry_safe(skb, next, head, list) {
   net_device*ev= skb->;
  struct net

 skb_list_del_init()
 skb (skb dev net)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
 if(kb=  }
   continue;

   (pskb_trim_rcsum + java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   =pv6_hdrskb);
   if
  ip6_sublist_rcvsublist, curr_net;
   *startnew *
 INIT_LIST_HEAD&);
  curr_dev =dev
   = net;
  }
  list_add_tail(skb-, &sublist)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 /* dispatch final sublist */
 if (!list_empty  (skb_sk_is_prefetched))
  ip6_sublist_rcv&, curr_devcurr_net)
}

err:

/*
 * Deliver the packet to the host
 */

voidip6_protocol_deliver_rcu(structnet *net struct sk_buff*skb intnexthdr,
 net NULL, skbdevNULL
{
 const struct inet6_protocol*ipprotjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
  void ip6_sublist_rcv(struct list_head head struct dev
 unsigned int
 (reason
  n NULL

 /*
 * Parse extension headers
 */


{
 idev = ip6_dst_idev(skb_dst(skb
 /
 java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 19
   f( == NULL_et NULL;
   LIST_HEAD(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    struct net *net
  skb = ip6_rcv_core(skb, dev, net);

resubmit_final:
 raw   /* dispatch old sublist */
 ipprot  rcu_dereference];
 if (ipprot) {
 int;

  ifhave_final){
   if         );
 staticvoid (struct *head structnet_devicedev
     * allow encapsulation     structnetnet)
       curr_net{
   *toIST(NF_INET_PRE_ROUTING net NULL
   list_add_tail     ead dev,N );
  gotodiscard

 ip6_sublist_rcvsublist  curr_net)
   const struct ipv6hdr *hdr;
   intinttcp_v6_rcv );
   struct net_device *java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

  /* Only do this once for first final protocol */ struct *orig_devjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
   have_final


   (skbskb_network_headerjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   idev=ip6_dst_idevskb_dstskb);
  dr(skb

 
   if(sdif) 
 (have_finaljava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
     ()
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

   = >;
   }

   (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  !ipv6_chk_mcast_addrdev &>,
      = cu_dereferenceinet6_protosnexthdr])java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
6_(, exthdrskb_network_header_lenskb)
  (reasonIP_INADDRERRORS)
  goto;
   /* Once we've seen a final protocol don't
}
if (!(ipprot->flags & INET6_PROTO_NOPOLICY)) {
if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) {
SKB_DR_SET(reason, XFRM_POLICY);
goto discard;
}
nf_reset_ct(skb);
}

ret = INDIRECT_CALL_2(ipprot->handler, tcp_v6_rcv, udpv6_rcv,
      skb);
if (ret > 0) {
if (ipprot->flags & INET6_PROTO_FINAL) {
/* Not an extension header, most likely UDP
 * encapsulation. Use return value as nexthdr
 * protocol not nhoff (which presumably is
 * not set by handler).
 */

    nexthdr =retjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   gotoresubmit_final
   } else {
    goto;
   java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
 }else ret
  _IP6_INC_STATS(,,)  java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
   if  *java.lang.StringIndexOutOfBoundsException: Range [24, 25) out of bounds for length 24
 }   * Parse extensionjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  iff !) {
   if (xfrm6_policy_check  =IP6CB)-nhoff   >;
 _IP6_INC_STATbr> DR nhoff)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
return;
   else{
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   }
   x0000.
  } else {
 java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 if =(,NF_INET_LOCAL_IN
 }
 } ifjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8

discard
_(, ,  java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
skbreason
}

static int ip6_input_finish(structjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
P_ATOMIC)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
 _  }else  skb2  skb  }
    (skb2java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
   if (likely(h ip6_input(java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 9
  return 0;
 }

 r 0;
 java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 1

 return 0;
}


int ip6_input    (!()> & )) {
{
 int res;

 rcu_read_lock();
 res  NF_HOOK(, ,
        dev_net_rcu(skb->dev), struct inet6_skb_parm *opt = IP6CB
        ip6_input_finish if(unlikely(pt-flags &&IP6SKB_ROUTERALERT)){
 rcu_read_unlock();

 return res;
}
EXPORT_SYMBOL_GPL(ip6_input);

int  _be16;
{
 struct net_device *dev = skb->dev;
 int sdif = inet6_sdif(skb);
 const struct ipv6hdr *hdr;java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 bool deliver;

 __IP6_UPD_PO_STATS(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  _in6_dev_get_safelydev) ,
     >)java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16

 /* skb->dev passed may be master dev for vrfs. */
 fsdif {
  dev = dev_get_by_index_rcu(dev_net_rcu(dev), sdif);
  f !)java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
   kfree_skb   (ipv6_is_mld(,nexthdr,offset
   return   true
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
 }

 hdr java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
 deliver=ipv6_chk_mcast_addr,&hdr-daddrNULL);

 CONFIG_IPV6_MROUTE
 /* skb2 = skb
 *      IPv6 multicast router mode is now supported ;)
 */

 if (atomic_read(&dev_net_rcu(skb->dev) ip6_mr_input)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
     i(&hdr->daddr
       (IPV6_ADDR_LOOPBACK|IPV6_ADDR_LINKLOCAL)) &&
     likely(!
/*
 * Okay, we try to forward - split and duplicate
 * packets.
 */

  struct sk_buff *skb2;
  struct inet6_skb_parm *opt = IP6CB(skb);

  /* Check for MLD */
  if (unlikely(opt->flags & IP6SKB_ROUTERALERT)) {
   /* Check if this is a mld message */
   u8 nexthdr = hdr->nexthdr;
   __be16 frag_off;
   int offset;

   /* Check if the value of Router Alert
 * is for MLD (0x0000).
 */

   if (opt->ra == htons(IPV6_OPT_ROUTERALERT_MLD)) {
    deliver = false;

    if (!ipv6_ext_hdr(nexthdr)) {
     /* BUG */
     goto out;
    }
    offset = ipv6_skip_exthdr(skb, sizeof(*hdr),
         &nexthdr, &frag_off);
    if (offset < 0)
     goto out;

    if (ipv6_is_mld(skb, nexthdr, offset))
     deliver = true;

    goto out;
   }
   /* unknown RA - process it normally */
  }

  if (deliver) {
   skb2 = skb_clone(skb, GFP_ATOMIC);
  } else {
   skb2 = skb;
   skb = NULL;
  }

  if (skb2)
   ip6_mr_input(skb2);
 }
out:
#endif
 if (likely(deliver)) {
  ip6_input(skb);
 } else {
  /* discard */
  kfree_skb(skb);
 }

 return 0;
}

Messung V0.5
C=97 H=88 G=92
h='4' stroke-dasharray='360' stroke-dashoffset='57' /> G=92

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.