mirror of
https://github.com/openvswitch/ovs
synced 2025-09-05 00:35:33 +00:00
ofpbuf: Rename trivial _get_ functions without the "get".
Code reads better without the "get", for example "ofpbuf_l3()" v.s. "ofpbuf_get_l3()". L4 payoad access functions still use the "get" (e.g., "ofpbuf_get_tcp_payload()"). Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
This commit is contained in:
@@ -557,7 +557,7 @@ cfm_compose_ccm(struct cfm *cfm, struct ofpbuf *packet,
|
||||
eth_push_vlan(packet, htons(ETH_TYPE_VLAN), htons(tci));
|
||||
}
|
||||
|
||||
ccm = ofpbuf_get_l3(packet);
|
||||
ccm = ofpbuf_l3(packet);
|
||||
ccm->mdlevel_version = 0;
|
||||
ccm->opcode = CCM_OPCODE;
|
||||
ccm->tlv_offset = 70;
|
||||
@@ -719,7 +719,7 @@ cfm_process_heartbeat(struct cfm *cfm, const struct ofpbuf *p)
|
||||
ovs_mutex_lock(&mutex);
|
||||
|
||||
eth = p->l2;
|
||||
ccm = ofpbuf_at(p, (uint8_t *)ofpbuf_get_l3(p) - (uint8_t *)ofpbuf_data(p),
|
||||
ccm = ofpbuf_at(p, (uint8_t *)ofpbuf_l3(p) - (uint8_t *)ofpbuf_data(p),
|
||||
CCM_ACCEPT_LEN);
|
||||
|
||||
if (!ccm) {
|
||||
|
@@ -181,7 +181,7 @@ parse_lacp_packet(const struct ofpbuf *b)
|
||||
{
|
||||
const struct lacp_pdu *pdu;
|
||||
|
||||
pdu = ofpbuf_at(b, (uint8_t *)ofpbuf_get_l3(b) - (uint8_t *)ofpbuf_data(b),
|
||||
pdu = ofpbuf_at(b, (uint8_t *)ofpbuf_l3(b) - (uint8_t *)ofpbuf_data(b),
|
||||
LACP_PDU_LEN);
|
||||
|
||||
if (pdu && pdu->subtype == 1
|
||||
|
@@ -51,7 +51,7 @@ odp_set_tunnel_action(const struct nlattr *a, struct flow_tnl *tun_key)
|
||||
static void
|
||||
set_arp(struct ofpbuf *packet, const struct ovs_key_arp *arp_key)
|
||||
{
|
||||
struct arp_eth_header *arp = ofpbuf_get_l3(packet);
|
||||
struct arp_eth_header *arp = ofpbuf_l3(packet);
|
||||
|
||||
arp->ar_op = arp_key->arp_op;
|
||||
memcpy(arp->ar_sha, arp_key->arp_sha, ETH_ADDR_LEN);
|
||||
|
@@ -68,16 +68,16 @@ ofp_packet_to_string(const void *data, size_t len)
|
||||
flow_extract(&buf, &md, &flow);
|
||||
flow_format(&ds, &flow);
|
||||
|
||||
l4_size = ofpbuf_get_l4_size(&buf);
|
||||
l4_size = ofpbuf_l4_size(&buf);
|
||||
|
||||
if (flow.nw_proto == IPPROTO_TCP && l4_size >= TCP_HEADER_LEN) {
|
||||
struct tcp_header *th = ofpbuf_get_l4(&buf);
|
||||
struct tcp_header *th = ofpbuf_l4(&buf);
|
||||
ds_put_format(&ds, " tcp_csum:%"PRIx16, ntohs(th->tcp_csum));
|
||||
} else if (flow.nw_proto == IPPROTO_UDP && l4_size >= UDP_HEADER_LEN) {
|
||||
struct udp_header *uh = ofpbuf_get_l4(&buf);
|
||||
struct udp_header *uh = ofpbuf_l4(&buf);
|
||||
ds_put_format(&ds, " udp_csum:%"PRIx16, ntohs(uh->udp_csum));
|
||||
} else if (flow.nw_proto == IPPROTO_SCTP && l4_size >= SCTP_HEADER_LEN) {
|
||||
struct sctp_header *sh = ofpbuf_get_l4(&buf);
|
||||
struct sctp_header *sh = ofpbuf_l4(&buf);
|
||||
ds_put_format(&ds, " sctp_csum:%"PRIx32, ntohl(sh->sctp_csum));
|
||||
}
|
||||
|
||||
|
@@ -2176,7 +2176,7 @@ ofputil_encode_flow_mod(const struct ofputil_flow_mod *fm,
|
||||
nfm->command = ofputil_tid_command(fm, protocol);
|
||||
nfm->cookie = fm->new_cookie;
|
||||
match_len = nx_put_match(msg, &fm->match, fm->cookie, fm->cookie_mask);
|
||||
nfm = ofpbuf_get_l3(msg);
|
||||
nfm = ofpbuf_l3(msg);
|
||||
nfm->idle_timeout = htons(fm->idle_timeout);
|
||||
nfm->hard_timeout = htons(fm->hard_timeout);
|
||||
nfm->priority = htons(fm->priority);
|
||||
@@ -2396,7 +2396,7 @@ ofputil_append_queue_get_config_reply(struct ofpbuf *reply,
|
||||
struct ofp12_packet_queue *opq12;
|
||||
ovs_be32 port;
|
||||
|
||||
qgcr11 = ofpbuf_get_l3(reply);
|
||||
qgcr11 = ofpbuf_l3(reply);
|
||||
port = qgcr11->port;
|
||||
|
||||
opq12 = ofpbuf_put_zeros(reply, sizeof *opq12);
|
||||
@@ -2636,7 +2636,7 @@ ofputil_encode_flow_stats_request(const struct ofputil_flow_stats_request *fsr,
|
||||
match_len = nx_put_match(msg, &fsr->match,
|
||||
fsr->cookie, fsr->cookie_mask);
|
||||
|
||||
nfsr = ofpbuf_get_l3(msg);
|
||||
nfsr = ofpbuf_l3(msg);
|
||||
nfsr->out_port = htons(ofp_to_u16(fsr->out_port));
|
||||
nfsr->match_len = htons(match_len);
|
||||
nfsr->table_id = fsr->table_id;
|
||||
@@ -2982,7 +2982,7 @@ ofputil_decode_aggregate_stats_reply(struct ofputil_aggregate_stats *stats,
|
||||
ofpbuf_use_const(&msg, reply, ntohs(reply->length));
|
||||
ofpraw_pull_assert(&msg);
|
||||
|
||||
asr = ofpbuf_get_l3(&msg);
|
||||
asr = ofpbuf_l3(&msg);
|
||||
stats->packet_count = ntohll(get_32aligned_be64(&asr->packet_count));
|
||||
stats->byte_count = ntohll(get_32aligned_be64(&asr->byte_count));
|
||||
stats->flow_count = ntohl(asr->flow_count);
|
||||
@@ -3134,7 +3134,7 @@ ofputil_encode_flow_removed(const struct ofputil_flow_removed *fr,
|
||||
nfr = ofpbuf_put_zeros(msg, sizeof *nfr);
|
||||
match_len = nx_put_match(msg, &fr->match, 0, 0);
|
||||
|
||||
nfr = ofpbuf_get_l3(msg);
|
||||
nfr = ofpbuf_l3(msg);
|
||||
nfr->cookie = fr->cookie;
|
||||
nfr->priority = htons(fr->priority);
|
||||
nfr->reason = fr->reason;
|
||||
@@ -3346,7 +3346,7 @@ ofputil_encode_nx_packet_in(const struct ofputil_packet_in *pin)
|
||||
ofpbuf_put_zeros(packet, 2);
|
||||
ofpbuf_put(packet, pin->packet, pin->packet_len);
|
||||
|
||||
npi = ofpbuf_get_l3(packet);
|
||||
npi = ofpbuf_l3(packet);
|
||||
npi->buffer_id = htonl(pin->buffer_id);
|
||||
npi->total_len = htons(pin->total_len);
|
||||
npi->reason = pin->reason;
|
||||
@@ -3410,7 +3410,7 @@ ofputil_encode_ofp12_packet_in(const struct ofputil_packet_in *pin,
|
||||
ofpbuf_put_zeros(packet, 2);
|
||||
ofpbuf_put(packet, pin->packet, pin->packet_len);
|
||||
|
||||
opi = ofpbuf_get_l3(packet);
|
||||
opi = ofpbuf_l3(packet);
|
||||
opi->pi.buffer_id = htonl(pin->buffer_id);
|
||||
opi->pi.total_len = htons(pin->total_len);
|
||||
opi->pi.reason = pin->reason;
|
||||
@@ -4629,7 +4629,7 @@ ofputil_decode_role_message(const struct ofp_header *oh,
|
||||
|
||||
if (raw == OFPRAW_OFPT12_ROLE_REQUEST ||
|
||||
raw == OFPRAW_OFPT12_ROLE_REPLY) {
|
||||
const struct ofp12_role_request *orr = ofpbuf_get_l3(&b);
|
||||
const struct ofp12_role_request *orr = ofpbuf_l3(&b);
|
||||
|
||||
if (orr->role != htonl(OFPCR12_ROLE_NOCHANGE) &&
|
||||
orr->role != htonl(OFPCR12_ROLE_EQUAL) &&
|
||||
@@ -4650,7 +4650,7 @@ ofputil_decode_role_message(const struct ofp_header *oh,
|
||||
}
|
||||
} else if (raw == OFPRAW_NXT_ROLE_REQUEST ||
|
||||
raw == OFPRAW_NXT_ROLE_REPLY) {
|
||||
const struct nx_role_request *nrr = ofpbuf_get_l3(&b);
|
||||
const struct nx_role_request *nrr = ofpbuf_l3(&b);
|
||||
|
||||
BUILD_ASSERT(NX_ROLE_OTHER + 1 == OFPCR12_ROLE_EQUAL);
|
||||
BUILD_ASSERT(NX_ROLE_MASTER + 1 == OFPCR12_ROLE_MASTER);
|
||||
@@ -4739,7 +4739,7 @@ ofputil_decode_role_status(const struct ofp_header *oh,
|
||||
raw = ofpraw_pull_assert(&b);
|
||||
ovs_assert(raw == OFPRAW_OFPT14_ROLE_STATUS);
|
||||
|
||||
r = ofpbuf_get_l3(&b);
|
||||
r = ofpbuf_l3(&b);
|
||||
if (r->role != htonl(OFPCR12_ROLE_NOCHANGE) &&
|
||||
r->role != htonl(OFPCR12_ROLE_EQUAL) &&
|
||||
r->role != htonl(OFPCR12_ROLE_MASTER) &&
|
||||
@@ -5211,7 +5211,7 @@ ofputil_encode_packet_out(const struct ofputil_packet_out *po,
|
||||
ofpacts_put_openflow_actions(po->ofpacts, po->ofpacts_len, msg,
|
||||
ofp_version);
|
||||
|
||||
opo = ofpbuf_get_l3(msg);
|
||||
opo = ofpbuf_l3(msg);
|
||||
opo->buffer_id = htonl(po->buffer_id);
|
||||
opo->in_port = htons(ofp_to_u16(po->in_port));
|
||||
opo->actions_len = htons(ofpbuf_size(msg) - actions_ofs);
|
||||
@@ -5229,7 +5229,7 @@ ofputil_encode_packet_out(const struct ofputil_packet_out *po,
|
||||
ofpbuf_put_zeros(msg, sizeof *opo);
|
||||
len = ofpacts_put_openflow_actions(po->ofpacts, po->ofpacts_len, msg,
|
||||
ofp_version);
|
||||
opo = ofpbuf_get_l3(msg);
|
||||
opo = ofpbuf_l3(msg);
|
||||
opo->buffer_id = htonl(po->buffer_id);
|
||||
opo->in_port = ofputil_port_to_ofp11(po->in_port);
|
||||
opo->actions_len = htons(len);
|
||||
|
34
lib/ofpbuf.h
34
lib/ofpbuf.h
@@ -69,13 +69,13 @@ static inline void ofpbuf_set_size(struct ofpbuf *, uint32_t);
|
||||
|
||||
void * ofpbuf_resize_l2(struct ofpbuf *, int increment);
|
||||
void * ofpbuf_resize_l2_5(struct ofpbuf *, int increment);
|
||||
static inline void * ofpbuf_get_l2_5(const struct ofpbuf *);
|
||||
static inline void * ofpbuf_l2_5(const struct ofpbuf *);
|
||||
static inline void ofpbuf_set_l2_5(struct ofpbuf *, void *);
|
||||
static inline void * ofpbuf_get_l3(const struct ofpbuf *);
|
||||
static inline void * ofpbuf_l3(const struct ofpbuf *);
|
||||
static inline void ofpbuf_set_l3(struct ofpbuf *, void *);
|
||||
static inline void * ofpbuf_get_l4(const struct ofpbuf *);
|
||||
static inline void * ofpbuf_l4(const struct ofpbuf *);
|
||||
static inline void ofpbuf_set_l4(struct ofpbuf *, void *);
|
||||
static inline size_t ofpbuf_get_l4_size(const struct ofpbuf *);
|
||||
static inline size_t ofpbuf_l4_size(const struct ofpbuf *);
|
||||
static inline const void *ofpbuf_get_tcp_payload(const struct ofpbuf *);
|
||||
static inline const void *ofpbuf_get_udp_payload(const struct ofpbuf *);
|
||||
static inline const void *ofpbuf_get_sctp_payload(const struct ofpbuf *);
|
||||
@@ -247,7 +247,7 @@ static inline bool ofpbuf_equal(const struct ofpbuf *a, const struct ofpbuf *b)
|
||||
memcmp(ofpbuf_data(a), ofpbuf_data(b), ofpbuf_size(a)) == 0;
|
||||
}
|
||||
|
||||
static inline void * ofpbuf_get_l2_5(const struct ofpbuf *b)
|
||||
static inline void * ofpbuf_l2_5(const struct ofpbuf *b)
|
||||
{
|
||||
return b->l2_5_ofs != UINT16_MAX ? (char *)b->l2 + b->l2_5_ofs : NULL;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ static inline void ofpbuf_set_l2_5(struct ofpbuf *b, void *l2_5)
|
||||
b->l2_5_ofs = l2_5 ? (char *)l2_5 - (char *)b->l2 : UINT16_MAX;
|
||||
}
|
||||
|
||||
static inline void * ofpbuf_get_l3(const struct ofpbuf *b)
|
||||
static inline void * ofpbuf_l3(const struct ofpbuf *b)
|
||||
{
|
||||
return b->l3_ofs != UINT16_MAX ? (char *)b->l2 + b->l3_ofs : NULL;
|
||||
}
|
||||
@@ -267,7 +267,7 @@ static inline void ofpbuf_set_l3(struct ofpbuf *b, void *l3)
|
||||
b->l3_ofs = l3 ? (char *)l3 - (char *)b->l2 : UINT16_MAX;
|
||||
}
|
||||
|
||||
static inline void * ofpbuf_get_l4(const struct ofpbuf *b)
|
||||
static inline void * ofpbuf_l4(const struct ofpbuf *b)
|
||||
{
|
||||
return b->l4_ofs != UINT16_MAX ? (char *)b->l2 + b->l4_ofs : NULL;
|
||||
}
|
||||
@@ -277,18 +277,18 @@ static inline void ofpbuf_set_l4(struct ofpbuf *b, void *l4)
|
||||
b->l4_ofs = l4 ? (char *)l4 - (char *)b->l2 : UINT16_MAX;
|
||||
}
|
||||
|
||||
static inline size_t ofpbuf_get_l4_size(const struct ofpbuf *b)
|
||||
static inline size_t ofpbuf_l4_size(const struct ofpbuf *b)
|
||||
{
|
||||
return b->l4_ofs != UINT16_MAX
|
||||
? (const char *)ofpbuf_tail(b) - (const char *)ofpbuf_get_l4(b) : 0;
|
||||
? (const char *)ofpbuf_tail(b) - (const char *)ofpbuf_l4(b) : 0;
|
||||
}
|
||||
|
||||
static inline const void *ofpbuf_get_tcp_payload(const struct ofpbuf *b)
|
||||
{
|
||||
size_t l4_size = ofpbuf_get_l4_size(b);
|
||||
size_t l4_size = ofpbuf_l4_size(b);
|
||||
|
||||
if (OVS_LIKELY(l4_size >= TCP_HEADER_LEN)) {
|
||||
struct tcp_header *tcp = ofpbuf_get_l4(b);
|
||||
struct tcp_header *tcp = ofpbuf_l4(b);
|
||||
int tcp_len = TCP_OFFSET(tcp->tcp_ctl) * 4;
|
||||
|
||||
if (OVS_LIKELY(tcp_len >= TCP_HEADER_LEN && tcp_len <= l4_size)) {
|
||||
@@ -300,20 +300,20 @@ static inline const void *ofpbuf_get_tcp_payload(const struct ofpbuf *b)
|
||||
|
||||
static inline const void *ofpbuf_get_udp_payload(const struct ofpbuf *b)
|
||||
{
|
||||
return OVS_LIKELY(ofpbuf_get_l4_size(b) >= UDP_HEADER_LEN)
|
||||
? (const char *)ofpbuf_get_l4(b) + UDP_HEADER_LEN : NULL;
|
||||
return OVS_LIKELY(ofpbuf_l4_size(b) >= UDP_HEADER_LEN)
|
||||
? (const char *)ofpbuf_l4(b) + UDP_HEADER_LEN : NULL;
|
||||
}
|
||||
|
||||
static inline const void *ofpbuf_get_sctp_payload(const struct ofpbuf *b)
|
||||
{
|
||||
return OVS_LIKELY(ofpbuf_get_l4_size(b) >= SCTP_HEADER_LEN)
|
||||
? (const char *)ofpbuf_get_l4(b) + SCTP_HEADER_LEN : NULL;
|
||||
return OVS_LIKELY(ofpbuf_l4_size(b) >= SCTP_HEADER_LEN)
|
||||
? (const char *)ofpbuf_l4(b) + SCTP_HEADER_LEN : NULL;
|
||||
}
|
||||
|
||||
static inline const void *ofpbuf_get_icmp_payload(const struct ofpbuf *b)
|
||||
{
|
||||
return OVS_LIKELY(ofpbuf_get_l4_size(b) >= ICMP_HEADER_LEN)
|
||||
? (const char *)ofpbuf_get_l4(b) + ICMP_HEADER_LEN : NULL;
|
||||
return OVS_LIKELY(ofpbuf_l4_size(b) >= ICMP_HEADER_LEN)
|
||||
? (const char *)ofpbuf_l4(b) + ICMP_HEADER_LEN : NULL;
|
||||
}
|
||||
|
||||
#ifdef DPDK_NETDEV
|
||||
|
@@ -212,10 +212,10 @@ set_ethertype(struct ofpbuf *packet, ovs_be16 eth_type)
|
||||
|
||||
if (eh->eth_type == htons(ETH_TYPE_VLAN)) {
|
||||
ovs_be16 *p;
|
||||
char *l2_5 = ofpbuf_get_l2_5(packet);
|
||||
char *l2_5 = ofpbuf_l2_5(packet);
|
||||
|
||||
p = ALIGNED_CAST(ovs_be16 *,
|
||||
(l2_5 ? l2_5 : (char *)ofpbuf_get_l3(packet)) - 2);
|
||||
(l2_5 ? l2_5 : (char *)ofpbuf_l3(packet)) - 2);
|
||||
*p = eth_type;
|
||||
} else {
|
||||
eh->eth_type = eth_type;
|
||||
@@ -279,7 +279,7 @@ set_mpls_lse(struct ofpbuf *packet, ovs_be32 mpls_lse)
|
||||
{
|
||||
/* Packet type should be MPLS to set label stack entry. */
|
||||
if (is_mpls(packet)) {
|
||||
struct mpls_hdr *mh = ofpbuf_get_l2_5(packet);
|
||||
struct mpls_hdr *mh = ofpbuf_l2_5(packet);
|
||||
|
||||
/* Update mpls label stack entry. */
|
||||
mh->mpls_lse = mpls_lse;
|
||||
@@ -321,7 +321,7 @@ void
|
||||
pop_mpls(struct ofpbuf *packet, ovs_be16 ethtype)
|
||||
{
|
||||
if (is_mpls(packet)) {
|
||||
struct mpls_hdr *mh = ofpbuf_get_l2_5(packet);
|
||||
struct mpls_hdr *mh = ofpbuf_l2_5(packet);
|
||||
size_t len = packet->l2_5_ofs;
|
||||
|
||||
set_ethertype(packet, ethtype);
|
||||
@@ -582,16 +582,16 @@ static void
|
||||
packet_set_ipv4_addr(struct ofpbuf *packet,
|
||||
ovs_16aligned_be32 *addr, ovs_be32 new_addr)
|
||||
{
|
||||
struct ip_header *nh = ofpbuf_get_l3(packet);
|
||||
struct ip_header *nh = ofpbuf_l3(packet);
|
||||
ovs_be32 old_addr = get_16aligned_be32(addr);
|
||||
size_t l4_size = ofpbuf_get_l4_size(packet);
|
||||
size_t l4_size = ofpbuf_l4_size(packet);
|
||||
|
||||
if (nh->ip_proto == IPPROTO_TCP && l4_size >= TCP_HEADER_LEN) {
|
||||
struct tcp_header *th = ofpbuf_get_l4(packet);
|
||||
struct tcp_header *th = ofpbuf_l4(packet);
|
||||
|
||||
th->tcp_csum = recalc_csum32(th->tcp_csum, old_addr, new_addr);
|
||||
} else if (nh->ip_proto == IPPROTO_UDP && l4_size >= UDP_HEADER_LEN ) {
|
||||
struct udp_header *uh = ofpbuf_get_l4(packet);
|
||||
struct udp_header *uh = ofpbuf_l4(packet);
|
||||
|
||||
if (uh->udp_csum) {
|
||||
uh->udp_csum = recalc_csum32(uh->udp_csum, old_addr, new_addr);
|
||||
@@ -615,7 +615,7 @@ packet_rh_present(struct ofpbuf *packet)
|
||||
int nexthdr;
|
||||
size_t len;
|
||||
size_t remaining;
|
||||
uint8_t *data = ofpbuf_get_l3(packet);
|
||||
uint8_t *data = ofpbuf_l3(packet);
|
||||
|
||||
remaining = packet->l4_ofs - packet->l3_ofs;
|
||||
|
||||
@@ -693,14 +693,14 @@ static void
|
||||
packet_update_csum128(struct ofpbuf *packet, uint8_t proto,
|
||||
ovs_16aligned_be32 addr[4], const ovs_be32 new_addr[4])
|
||||
{
|
||||
size_t l4_size = ofpbuf_get_l4_size(packet);
|
||||
size_t l4_size = ofpbuf_l4_size(packet);
|
||||
|
||||
if (proto == IPPROTO_TCP && l4_size >= TCP_HEADER_LEN) {
|
||||
struct tcp_header *th = ofpbuf_get_l4(packet);
|
||||
struct tcp_header *th = ofpbuf_l4(packet);
|
||||
|
||||
th->tcp_csum = recalc_csum128(th->tcp_csum, addr, new_addr);
|
||||
} else if (proto == IPPROTO_UDP && l4_size >= UDP_HEADER_LEN) {
|
||||
struct udp_header *uh = ofpbuf_get_l4(packet);
|
||||
struct udp_header *uh = ofpbuf_l4(packet);
|
||||
|
||||
if (uh->udp_csum) {
|
||||
uh->udp_csum = recalc_csum128(uh->udp_csum, addr, new_addr);
|
||||
@@ -746,7 +746,7 @@ void
|
||||
packet_set_ipv4(struct ofpbuf *packet, ovs_be32 src, ovs_be32 dst,
|
||||
uint8_t tos, uint8_t ttl)
|
||||
{
|
||||
struct ip_header *nh = ofpbuf_get_l3(packet);
|
||||
struct ip_header *nh = ofpbuf_l3(packet);
|
||||
|
||||
if (get_16aligned_be32(&nh->ip_src) != src) {
|
||||
packet_set_ipv4_addr(packet, &nh->ip_src, src);
|
||||
@@ -782,7 +782,7 @@ packet_set_ipv6(struct ofpbuf *packet, uint8_t proto, const ovs_be32 src[4],
|
||||
const ovs_be32 dst[4], uint8_t key_tc, ovs_be32 key_fl,
|
||||
uint8_t key_hl)
|
||||
{
|
||||
struct ovs_16aligned_ip6_hdr *nh = ofpbuf_get_l3(packet);
|
||||
struct ovs_16aligned_ip6_hdr *nh = ofpbuf_l3(packet);
|
||||
|
||||
if (memcmp(&nh->ip6_src, src, sizeof(ovs_be32[4]))) {
|
||||
packet_set_ipv6_addr(packet, proto, nh->ip6_src.be32, src, true);
|
||||
@@ -815,7 +815,7 @@ packet_set_port(ovs_be16 *port, ovs_be16 new_port, ovs_be16 *csum)
|
||||
void
|
||||
packet_set_tcp_port(struct ofpbuf *packet, ovs_be16 src, ovs_be16 dst)
|
||||
{
|
||||
struct tcp_header *th = ofpbuf_get_l4(packet);
|
||||
struct tcp_header *th = ofpbuf_l4(packet);
|
||||
|
||||
packet_set_port(&th->tcp_src, src, &th->tcp_csum);
|
||||
packet_set_port(&th->tcp_dst, dst, &th->tcp_csum);
|
||||
@@ -827,7 +827,7 @@ packet_set_tcp_port(struct ofpbuf *packet, ovs_be16 src, ovs_be16 dst)
|
||||
void
|
||||
packet_set_udp_port(struct ofpbuf *packet, ovs_be16 src, ovs_be16 dst)
|
||||
{
|
||||
struct udp_header *uh = ofpbuf_get_l4(packet);
|
||||
struct udp_header *uh = ofpbuf_l4(packet);
|
||||
|
||||
if (uh->udp_csum) {
|
||||
packet_set_port(&uh->udp_src, src, &uh->udp_csum);
|
||||
@@ -848,7 +848,7 @@ packet_set_udp_port(struct ofpbuf *packet, ovs_be16 src, ovs_be16 dst)
|
||||
void
|
||||
packet_set_sctp_port(struct ofpbuf *packet, ovs_be16 src, ovs_be16 dst)
|
||||
{
|
||||
struct sctp_header *sh = ofpbuf_get_l4(packet);
|
||||
struct sctp_header *sh = ofpbuf_l4(packet);
|
||||
ovs_be32 old_csum, old_correct_csum, new_csum;
|
||||
uint16_t tp_len = ofpbuf_size(packet) - ((uint8_t*)sh - (uint8_t*)ofpbuf_data(packet));
|
||||
|
||||
|
@@ -310,7 +310,7 @@ tcp_reader_run(struct tcp_reader *r, const struct flow *flow,
|
||||
|| !l7) {
|
||||
return NULL;
|
||||
}
|
||||
tcp = ofpbuf_get_l4(packet);
|
||||
tcp = ofpbuf_l4(packet);
|
||||
flags = TCP_FLAGS(tcp->tcp_ctl);
|
||||
l7_length = (char *) ofpbuf_tail(packet) - l7;
|
||||
seq = ntohl(get_16aligned_be32(&tcp->tcp_seq));
|
||||
|
@@ -93,7 +93,7 @@ send_bpdu(struct ofpbuf *pkt, int port_no, void *b_)
|
||||
assert(port_no < b->n_ports);
|
||||
lan = b->ports[port_no];
|
||||
if (lan) {
|
||||
const void *data = ofpbuf_get_l3(pkt);
|
||||
const void *data = ofpbuf_l3(pkt);
|
||||
size_t size = (char *) ofpbuf_tail(pkt) - (char *) data;
|
||||
int i;
|
||||
|
||||
|
@@ -1964,7 +1964,7 @@ ofctl_ping(int argc, char *argv[])
|
||||
if (ofptype_pull(&type, reply)
|
||||
|| type != OFPTYPE_ECHO_REPLY
|
||||
|| ofpbuf_size(reply) != payload
|
||||
|| memcmp(ofpbuf_get_l3(request), ofpbuf_get_l3(reply), payload)) {
|
||||
|| memcmp(ofpbuf_l3(request), ofpbuf_l3(reply), payload)) {
|
||||
printf("Reply does not match request. Request:\n");
|
||||
ofp_print(stdout, request, ofpbuf_size(request), verbosity + 2);
|
||||
printf("Reply:\n");
|
||||
|
Reference in New Issue
Block a user