Skip to content

Commit 576e26d

Browse files
committed
Merge citrix branch into master.
2 parents 2a6cb30 + 36beceb commit 576e26d

25 files changed

Lines changed: 565 additions & 92 deletions

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
v0.90.5 - 21 Sep 2009
2+
---------------------
3+
- Generalize in-band control to more diverse network setups
4+
- Bug fixes

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
AC_PREREQ(2.63)
16-
AC_INIT(openvswitch, 0.90.3, bugs@openvswitch.org)
16+
AC_INIT(openvswitch, 0.90.5, ovs-bugs@openvswitch.org)
1717
NX_BUILDNR
1818
AC_CONFIG_SRCDIR([datapath/datapath.c])
1919
AC_CONFIG_MACRO_DIR([m4])

datapath/datapath.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* then this should go into include/linux/if_vlan.h. */
2626
#define VLAN_PCP_MASK 0xe000
2727

28-
#define DP_MAX_PORTS 256
28+
#define DP_MAX_PORTS 1024
2929
#define DP_MAX_GROUPS 16
3030

3131
#define DP_L2_BITS (PAGE_SHIFT - ilog2(sizeof(struct dp_bucket*)))

lib/automake.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ lib_libopenvswitch_a_SOURCES = \
6767
lib/ofp-print.h \
6868
lib/ofpbuf.c \
6969
lib/ofpbuf.h \
70+
lib/packets.c \
7071
lib/packets.h \
7172
lib/pcap.c \
7273
lib/pcap.h \

lib/mac-learning.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#define MAC_HASH_MASK (MAC_HASH_SIZE - 1)
2727
#define MAC_HASH_SIZE (1u << MAC_HASH_BITS)
2828

29-
#define MAC_MAX 1024
29+
#define MAC_MAX 2048
3030

3131
/* Time, in seconds, before expiring a mac_entry due to inactivity. */
3232
#define MAC_ENTRY_IDLE_TIME 60

lib/netdev-linux.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,6 +1496,7 @@ get_stats_via_netlink(int ifindex, struct netdev_stats *stats)
14961496

14971497
if (!attrs[IFLA_STATS]) {
14981498
VLOG_WARN_RL(&rl, "RTM_GETLINK reply lacks stats");
1499+
ofpbuf_delete(reply);
14991500
return EPROTO;
15001501
}
15011502

@@ -1522,6 +1523,8 @@ get_stats_via_netlink(int ifindex, struct netdev_stats *stats)
15221523
stats->tx_heartbeat_errors = rtnl_stats->tx_heartbeat_errors;
15231524
stats->tx_window_errors = rtnl_stats->tx_window_errors;
15241525

1526+
ofpbuf_delete(reply);
1527+
15251528
return 0;
15261529
}
15271530

lib/packets.c

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright (c) 2009 Nicira Networks.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at:
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <config.h>
18+
#include "packets.h"
19+
#include <netinet/in.h>
20+
#include "ofpbuf.h"
21+
22+
/* Fills 'b' with an 802.2 SNAP packet with Ethernet source address 'eth_src',
23+
* the Nicira OUI as SNAP organization and 'snap_type' as SNAP type. The text
24+
* string in 'tag' is enclosed as the packet payload.
25+
*
26+
* This function is used by Open vSwitch to compose packets in cases where
27+
* context is important but content doesn't (or shouldn't) matter. For this
28+
* purpose, 'snap_type' should be a random number and 'tag' should be an
29+
* English phrase that explains the purpose of the packet. (The English phrase
30+
* gives hapless admins running Wireshark the opportunity to figure out what's
31+
* going on.) */
32+
void
33+
compose_benign_packet(struct ofpbuf *b, const char *tag, uint16_t snap_type,
34+
const uint8_t eth_src[ETH_ADDR_LEN])
35+
{
36+
struct eth_header *eth;
37+
struct llc_snap_header *llc_snap;
38+
39+
/* Compose basic packet structure. (We need the payload size to stick into
40+
* the 802.2 header.) */
41+
ofpbuf_clear(b);
42+
eth = ofpbuf_put_zeros(b, ETH_HEADER_LEN);
43+
llc_snap = ofpbuf_put_zeros(b, LLC_SNAP_HEADER_LEN);
44+
ofpbuf_put(b, tag, strlen(tag) + 1); /* Includes null byte. */
45+
ofpbuf_put(b, eth_src, ETH_ADDR_LEN);
46+
47+
/* Compose 802.2 header. */
48+
memcpy(eth->eth_dst, eth_addr_broadcast, ETH_ADDR_LEN);
49+
memcpy(eth->eth_src, eth_src, ETH_ADDR_LEN);
50+
eth->eth_type = htons(b->size - ETH_HEADER_LEN);
51+
52+
/* Compose LLC, SNAP headers. */
53+
llc_snap->llc.llc_dsap = LLC_DSAP_SNAP;
54+
llc_snap->llc.llc_ssap = LLC_SSAP_SNAP;
55+
llc_snap->llc.llc_cntl = LLC_CNTL_SNAP;
56+
memcpy(llc_snap->snap.snap_org, "\x00\x23\x20", 3);
57+
llc_snap->snap.snap_type = htons(snap_type);
58+
}

lib/packets.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
#ifndef PACKETS_H
1718
#define PACKETS_H 1
1819

@@ -23,6 +24,8 @@
2324
#include "random.h"
2425
#include "util.h"
2526

27+
struct ofpbuf;
28+
2629
#define ETH_ADDR_LEN 6
2730

2831
static const uint8_t eth_addr_broadcast[ETH_ADDR_LEN] UNUSED
@@ -98,6 +101,10 @@ static inline bool eth_addr_is_reserved(const uint8_t ea[ETH_ADDR_LEN])
98101
&& (ea[5] & 0xf0) == 0x00);
99102
}
100103

104+
void compose_benign_packet(struct ofpbuf *, const char *tag,
105+
uint16_t snap_type,
106+
const uint8_t eth_src[ETH_ADDR_LEN]);
107+
101108
/* Example:
102109
*
103110
* uint8_t mac[ETH_ADDR_LEN];

lib/rconn.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ rconn_recv(struct rconn *rc)
499499
int error = vconn_recv(rc->vconn, &buffer);
500500
if (!error) {
501501
copy_to_monitor(rc, buffer);
502-
if (is_admitted_msg(buffer)
502+
if (rc->probably_admitted || is_admitted_msg(buffer)
503503
|| time_now() - rc->last_connected >= 30) {
504504
rc->probably_admitted = true;
505505
rc->last_admitted = time_now();
@@ -637,15 +637,22 @@ rconn_is_connected(const struct rconn *rconn)
637637
return is_connected_state(rconn->state);
638638
}
639639

640-
/* Returns 0 if 'rconn' is connected. Otherwise, if 'rconn' is in a "failure
641-
* mode" (that is, it is not connected), returns the number of seconds that it
642-
* has been in failure mode, ignoring any times that it connected but the
643-
* controller's admission control policy caused it to be quickly
644-
* disconnected. */
640+
/* Returns true if 'rconn' is connected and thought to have been accepted by
641+
* the peer's admission-control policy. */
642+
bool
643+
rconn_is_admitted(const struct rconn *rconn)
644+
{
645+
return (rconn_is_connected(rconn)
646+
&& rconn->last_admitted >= rconn->last_connected);
647+
}
648+
649+
/* Returns 0 if 'rconn' is currently connected and considered to have been
650+
* accepted by the peer's admission-control policy, otherwise the number of
651+
* seconds since 'rconn' was last in such a state. */
645652
int
646653
rconn_failure_duration(const struct rconn *rconn)
647654
{
648-
return rconn_is_connected(rconn) ? 0 : time_now() - rconn->last_admitted;
655+
return rconn_is_admitted(rconn) ? 0 : time_now() - rconn->last_admitted;
649656
}
650657

651658
/* Returns the IP address of the peer, or 0 if the peer's IP address is not

lib/rconn.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ void rconn_add_monitor(struct rconn *, struct vconn *);
6969
const char *rconn_get_name(const struct rconn *);
7070
bool rconn_is_alive(const struct rconn *);
7171
bool rconn_is_connected(const struct rconn *);
72+
bool rconn_is_admitted(const struct rconn *);
7273
int rconn_failure_duration(const struct rconn *);
7374
bool rconn_is_connectivity_questionable(struct rconn *);
7475

0 commit comments

Comments
 (0)