Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
isisd: implement draft-ietf-isis-ext-eth and support p2p over LAN on BSD
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
- Loading branch information
Showing
with
16 additions
and
32 deletions.
-
+3
−30
isisd/isis_bpf.c
-
+10
−0
isisd/isis_constants.h
-
+3
−2
isisd/isis_pfpacket.c
|
|
@@ -212,16 +212,11 @@ isis_sock_init (struct isis_circuit *circuit) |
|
|
goto end; |
|
|
} |
|
|
|
|
|
if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
|
|
if (if_is_broadcast(circuit->interface)) |
|
|
{ |
|
|
circuit->tx = isis_send_pdu_bcast; |
|
|
circuit->rx = isis_recv_pdu_bcast; |
|
|
} |
|
|
else if (circuit->circ_type == CIRCUIT_T_P2P) |
|
|
{ |
|
|
circuit->tx = isis_send_pdu_p2p; |
|
|
circuit->rx = isis_recv_pdu_p2p; |
|
|
} |
|
|
else |
|
|
{ |
|
|
zlog_warn ("isis_sock_init(): unknown circuit type"); |
|
|
@@ -283,23 +278,6 @@ isis_recv_pdu_bcast (struct isis_circuit *circuit, u_char * ssnpa) |
|
|
return ISIS_OK; |
|
|
} |
|
|
|
|
|
int |
|
|
isis_recv_pdu_p2p (struct isis_circuit *circuit, u_char * ssnpa) |
|
|
{ |
|
|
int bytesread; |
|
|
|
|
|
bytesread = stream_read (circuit->rcv_stream, circuit->fd, |
|
|
circuit->interface->mtu); |
|
|
|
|
|
if (bytesread < 0) |
|
|
{ |
|
|
zlog_warn ("isis_recv_pdu_p2p(): read () failed: %s", safe_strerror (errno)); |
|
|
return ISIS_WARNING; |
|
|
} |
|
|
|
|
|
return ISIS_OK; |
|
|
} |
|
|
|
|
|
int |
|
|
isis_send_pdu_bcast (struct isis_circuit *circuit, int level) |
|
|
{ |
|
|
@@ -327,7 +305,8 @@ isis_send_pdu_bcast (struct isis_circuit *circuit, int level) |
|
|
else |
|
|
memcpy (eth->ether_dhost, ALL_L2_ISS, ETHER_ADDR_LEN); |
|
|
memcpy (eth->ether_shost, circuit->u.bc.snpa, ETHER_ADDR_LEN); |
|
|
eth->ether_type = htons (stream_get_endp (circuit->snd_stream) + LLC_LEN); |
|
|
size_t frame_size = stream_get_endp(circuit->snd_stream) + LLC_LEN; |
|
|
eth->ether_type = htons(isis_ethertype(frame_size)); |
|
|
|
|
|
/* |
|
|
* Then the LLC |
|
|
@@ -354,10 +333,4 @@ isis_send_pdu_bcast (struct isis_circuit *circuit, int level) |
|
|
return ISIS_OK; |
|
|
} |
|
|
|
|
|
int |
|
|
isis_send_pdu_p2p (struct isis_circuit *circuit, int level) |
|
|
{ |
|
|
return ISIS_OK; |
|
|
} |
|
|
|
|
|
#endif /* ISIS_METHOD == ISIS_METHOD_BPF */ |
|
|
@@ -171,4 +171,14 @@ |
|
|
#define ETH_ALEN 6 |
|
|
#endif |
|
|
|
|
|
#define MAX_LLC_LEN 0x5ff |
|
|
#define ETHERTYPE_EXT_LLC 0x8870 |
|
|
|
|
|
static inline uint16_t isis_ethertype(size_t len) |
|
|
{ |
|
|
if (len > MAX_LLC_LEN) |
|
|
return ETHERTYPE_EXT_LLC; |
|
|
return len; |
|
|
} |
|
|
|
|
|
#endif /* ISIS_CONSTANTS_H */ |
|
|
@@ -371,7 +371,9 @@ isis_send_pdu_bcast (struct isis_circuit *circuit, int level) |
|
|
stream_set_getp (circuit->snd_stream, 0); |
|
|
memset (&sa, 0, sizeof (struct sockaddr_ll)); |
|
|
sa.sll_family = AF_PACKET; |
|
|
sa.sll_protocol = htons (stream_get_endp (circuit->snd_stream) + LLC_LEN); |
|
|
|
|
|
size_t frame_size = stream_get_endp(circuit->snd_stream) + LLC_LEN; |
|
|
sa.sll_protocol = htons(isis_ethertype(frame_size)); |
|
|
sa.sll_ifindex = circuit->interface->ifindex; |
|
|
sa.sll_halen = ETH_ALEN; |
|
|
/* RFC5309 section 4.1 recommends ALL_ISS */ |
|
|
@@ -418,7 +420,6 @@ isis_send_pdu_p2p (struct isis_circuit *circuit, int level) |
|
|
stream_set_getp (circuit->snd_stream, 0); |
|
|
memset (&sa, 0, sizeof (struct sockaddr_ll)); |
|
|
sa.sll_family = AF_PACKET; |
|
|
sa.sll_protocol = htons (stream_get_endp (circuit->snd_stream) + LLC_LEN); |
|
|
sa.sll_ifindex = circuit->interface->ifindex; |
|
|
sa.sll_halen = ETH_ALEN; |
|
|
if (level == 1) |
|
|
|