flow.c (91de76e661a266731fc2889a398ad1694df9d523) flow.c (b2d0f5d5dc53532e6f07bc546a476a55ebdfe0f3)
1/*
2 * Copyright (c) 2007-2014 Nicira, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General Public
6 * License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but

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

41#include <linux/icmp.h>
42#include <linux/icmpv6.h>
43#include <linux/rculist.h>
44#include <net/ip.h>
45#include <net/ip_tunnels.h>
46#include <net/ipv6.h>
47#include <net/mpls.h>
48#include <net/ndisc.h>
1/*
2 * Copyright (c) 2007-2014 Nicira, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General Public
6 * License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but

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

41#include <linux/icmp.h>
42#include <linux/icmpv6.h>
43#include <linux/rculist.h>
44#include <net/ip.h>
45#include <net/ip_tunnels.h>
46#include <net/ipv6.h>
47#include <net/mpls.h>
48#include <net/ndisc.h>
49#include <net/nsh.h>
49
50#include "conntrack.h"
51#include "datapath.h"
52#include "flow.h"
53#include "flow_netlink.h"
54#include "vport.h"
55
56u64 ovs_flow_used_time(unsigned long flow_jiffies)

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

485invalid:
486 memset(&key->ipv6.nd.target, 0, sizeof(key->ipv6.nd.target));
487 memset(key->ipv6.nd.sll, 0, sizeof(key->ipv6.nd.sll));
488 memset(key->ipv6.nd.tll, 0, sizeof(key->ipv6.nd.tll));
489
490 return 0;
491}
492
50
51#include "conntrack.h"
52#include "datapath.h"
53#include "flow.h"
54#include "flow_netlink.h"
55#include "vport.h"
56
57u64 ovs_flow_used_time(unsigned long flow_jiffies)

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

486invalid:
487 memset(&key->ipv6.nd.target, 0, sizeof(key->ipv6.nd.target));
488 memset(key->ipv6.nd.sll, 0, sizeof(key->ipv6.nd.sll));
489 memset(key->ipv6.nd.tll, 0, sizeof(key->ipv6.nd.tll));
490
491 return 0;
492}
493
494static int parse_nsh(struct sk_buff *skb, struct sw_flow_key *key)
495{
496 struct nshhdr *nh;
497 unsigned int nh_ofs = skb_network_offset(skb);
498 u8 version, length;
499 int err;
500
501 err = check_header(skb, nh_ofs + NSH_BASE_HDR_LEN);
502 if (unlikely(err))
503 return err;
504
505 nh = nsh_hdr(skb);
506 version = nsh_get_ver(nh);
507 length = nsh_hdr_len(nh);
508
509 if (version != 0)
510 return -EINVAL;
511
512 err = check_header(skb, nh_ofs + length);
513 if (unlikely(err))
514 return err;
515
516 nh = nsh_hdr(skb);
517 key->nsh.base.flags = nsh_get_flags(nh);
518 key->nsh.base.ttl = nsh_get_ttl(nh);
519 key->nsh.base.mdtype = nh->mdtype;
520 key->nsh.base.np = nh->np;
521 key->nsh.base.path_hdr = nh->path_hdr;
522 switch (key->nsh.base.mdtype) {
523 case NSH_M_TYPE1:
524 if (length != NSH_M_TYPE1_LEN)
525 return -EINVAL;
526 memcpy(key->nsh.context, nh->md1.context,
527 sizeof(nh->md1));
528 break;
529 case NSH_M_TYPE2:
530 memset(key->nsh.context, 0,
531 sizeof(nh->md1));
532 break;
533 default:
534 return -EINVAL;
535 }
536
537 return 0;
538}
539
493/**
494 * key_extract - extracts a flow key from an Ethernet frame.
495 * @skb: sk_buff that contains the frame, with skb->data pointing to the
496 * Ethernet header
497 * @key: output flow key
498 *
499 * The caller must ensure that skb->len >= ETH_HLEN.
500 *

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

730 if (icmp6hdr_ok(skb)) {
731 error = parse_icmpv6(skb, key, nh_len);
732 if (error)
733 return error;
734 } else {
735 memset(&key->tp, 0, sizeof(key->tp));
736 }
737 }
540/**
541 * key_extract - extracts a flow key from an Ethernet frame.
542 * @skb: sk_buff that contains the frame, with skb->data pointing to the
543 * Ethernet header
544 * @key: output flow key
545 *
546 * The caller must ensure that skb->len >= ETH_HLEN.
547 *

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

777 if (icmp6hdr_ok(skb)) {
778 error = parse_icmpv6(skb, key, nh_len);
779 if (error)
780 return error;
781 } else {
782 memset(&key->tp, 0, sizeof(key->tp));
783 }
784 }
785 } else if (key->eth.type == htons(ETH_P_NSH)) {
786 error = parse_nsh(skb, key);
787 if (error)
788 return error;
738 }
739 return 0;
740}
741
742int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key)
743{
744 int res;
745

--- 109 unchanged lines hidden ---
789 }
790 return 0;
791}
792
793int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key)
794{
795 int res;
796

--- 109 unchanged lines hidden ---