summaryrefslogtreecommitdiffstats
path: root/net/mctp
diff options
context:
space:
mode:
authorMatt Johnston <matt@codeconstruct.com.au>2021-07-29 04:20:51 +0200
committerDavid S. Miller <davem@davemloft.net>2021-07-29 16:06:50 +0200
commit26ab3fcaf23568cc8fc06aeb9306f3544969f252 (patch)
tree38eeda6b66d0f0eec8912c2f033cd5ca5d2090f6 /net/mctp
parentmctp: Implement message fragmentation & reassembly (diff)
downloadlinux-26ab3fcaf23568cc8fc06aeb9306f3544969f252.tar.xz
linux-26ab3fcaf23568cc8fc06aeb9306f3544969f252.zip
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>
Diffstat (limited to 'net/mctp')
-rw-r--r--net/mctp/route.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/net/mctp/route.c b/net/mctp/route.c
index 160220e6f241..38f0a7278520 100644
--- a/net/mctp/route.c
+++ b/net/mctp/route.c
@@ -376,6 +376,9 @@ static unsigned int mctp_route_mtu(struct mctp_route *rt)
static int mctp_route_output(struct mctp_route *route, struct sk_buff *skb)
{
+ struct mctp_hdr *hdr = mctp_hdr(skb);
+ char daddr_buf[MAX_ADDR_LEN];
+ char *daddr = NULL;
unsigned int mtu;
int rc;
@@ -387,9 +390,12 @@ static int mctp_route_output(struct mctp_route *route, struct sk_buff *skb)
return -EMSGSIZE;
}
- /* TODO: daddr (from rt->neigh), saddr (from device?) */
+ /* If lookup fails let the device handle daddr==NULL */
+ if (mctp_neigh_lookup(route->dev, hdr->dest, daddr_buf) == 0)
+ daddr = daddr_buf;
+
rc = dev_hard_header(skb, skb->dev, ntohs(skb->protocol),
- NULL, NULL, skb->len);
+ daddr, skb->dev->dev_addr, skb->len);
if (rc) {
kfree_skb(skb);
return -EHOSTUNREACH;