projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ovs-openflowd: Standardize on OpenFlow description option
[openvswitch]
/
lib
/
packets.h
diff --git
a/lib/packets.h
b/lib/packets.h
index f61c20ca5896e3ddc2200f38c90c3b7fc7197ccf..eaffca939c063adeb7429d835ca0c2a699ce2037 100644
(file)
--- a/
lib/packets.h
+++ b/
lib/packets.h
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 2008, 2009 Nicira Networks.
+ * Copyright (c) 2008, 2009
, 2010
Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-30,7
+30,7
@@
bool dpid_from_string(const char *s, uint64_t *dpidp);
#define ETH_ADDR_LEN 6
#define ETH_ADDR_LEN 6
-static const uint8_t eth_addr_broadcast[ETH_ADDR_LEN] UNUSED
+static const uint8_t eth_addr_broadcast[ETH_ADDR_LEN]
OVS_
UNUSED
= { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
static inline bool eth_addr_is_broadcast(const uint8_t ea[6])
= { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
static inline bool eth_addr_is_broadcast(const uint8_t ea[6])
@@
-44,7
+44,10
@@
static inline bool eth_addr_is_multicast(const uint8_t ea[6])
}
static inline bool eth_addr_is_local(const uint8_t ea[6])
{
}
static inline bool eth_addr_is_local(const uint8_t ea[6])
{
- return ea[0] & 2;
+ /* Local if it is either a locally administered address or a Nicira random
+ * address. */
+ return !!(ea[0] & 2)
+ || (ea[0] == 0x00 && ea[1] == 0x23 && ea[2] == 0x20 && !!(ea[3] & 0x80));
}
static inline bool eth_addr_is_zero(const uint8_t ea[6])
{
}
static inline bool eth_addr_is_zero(const uint8_t ea[6])
{
@@
-83,6
+86,18
@@
static inline void eth_addr_random(uint8_t ea[ETH_ADDR_LEN])
random_bytes(ea, ETH_ADDR_LEN);
eth_addr_mark_random(ea);
}
random_bytes(ea, ETH_ADDR_LEN);
eth_addr_mark_random(ea);
}
+static inline void eth_addr_nicira_random(uint8_t ea[ETH_ADDR_LEN])
+{
+ eth_addr_random(ea);
+
+ /* Set the OUI to the Nicira one. */
+ ea[0] = 0x00;
+ ea[1] = 0x23;
+ ea[2] = 0x20;
+
+ /* Set the top bit to indicate random Nicira address. */
+ ea[3] |= 0x80;
+}
/* Returns true if 'ea' is a reserved multicast address, that a bridge must
* never forward, false otherwise. */
static inline bool eth_addr_is_reserved(const uint8_t ea[ETH_ADDR_LEN])
/* Returns true if 'ea' is a reserved multicast address, that a bridge must
* never forward, false otherwise. */
static inline bool eth_addr_is_reserved(const uint8_t ea[ETH_ADDR_LEN])