Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mctp: Add dest neighbour lladdr to route output

Now that we have a neighbour implementation, hook it up to the output
path to set the dest hardware address for outgoing packets.

Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Matt Johnston and committed by
David S. Miller
26ab3fca 4a992bbd

+8 -2
+8 -2
net/mctp/route.c
··· 376 376 377 377 static int mctp_route_output(struct mctp_route *route, struct sk_buff *skb) 378 378 { 379 + struct mctp_hdr *hdr = mctp_hdr(skb); 380 + char daddr_buf[MAX_ADDR_LEN]; 381 + char *daddr = NULL; 379 382 unsigned int mtu; 380 383 int rc; 381 384 ··· 390 387 return -EMSGSIZE; 391 388 } 392 389 393 - /* TODO: daddr (from rt->neigh), saddr (from device?) */ 390 + /* If lookup fails let the device handle daddr==NULL */ 391 + if (mctp_neigh_lookup(route->dev, hdr->dest, daddr_buf) == 0) 392 + daddr = daddr_buf; 393 + 394 394 rc = dev_hard_header(skb, skb->dev, ntohs(skb->protocol), 395 - NULL, NULL, skb->len); 395 + daddr, skb->dev->dev_addr, skb->len); 396 396 if (rc) { 397 397 kfree_skb(skb); 398 398 return -EHOSTUNREACH;