return 1;
}
-static uword
-ppp_set_rewrite (vnet_main_t * vnm,
- u32 sw_if_index,
- u32 l3_type,
- void *dst_address, void *rewrite, uword max_rewrite_bytes)
+static u8 *
+ppp_build_rewrite (vnet_main_t * vnm,
+ u32 sw_if_index,
+ vnet_link_t link_type, const void *dst_hw_address)
{
- ppp_header_t *h = rewrite;
+ ppp_header_t *h;
+ u8 *rewrite = NULL;
ppp_protocol_t protocol;
- if (max_rewrite_bytes < sizeof (h[0]))
- return 0;
-
- switch (l3_type)
+ switch (link_type)
{
-#define _(a,b) case VNET_L3_PACKET_TYPE_##a: protocol = PPP_PROTOCOL_##b; break
+#define _(a,b) case VNET_LINK_##a: protocol = PPP_PROTOCOL_##b; break
_(IP4, ip4);
_(IP6, ip6);
- _(MPLS_UNICAST, mpls_unicast);
- _(MPLS_MULTICAST, mpls_multicast);
+ _(MPLS, mpls_unicast);
#undef _
default:
- return 0;
+ return (NULL);
}
+ vec_validate (rewrite, sizeof (*h) - 1);
+ h = (ppp_header_t *) rewrite;
h->address = 0xff;
h->control = 0x03;
h->protocol = clib_host_to_net_u16 (protocol);
- return sizeof (h[0]);
+ return (rewrite);
}
/* *INDENT-OFF* */
.name = "PPP",
.format_header = format_ppp_header_with_length,
.unformat_header = unformat_ppp_header,
- .set_rewrite = ppp_set_rewrite,
+ .build_rewrite = ppp_build_rewrite,
+ .flags = VNET_HW_INTERFACE_CLASS_FLAG_P2P,
};
/* *INDENT-ON* */