Revision 4d367961

View differences:

sysdep/bsd/krt-sock.c
186 186
    memcpy(p, body, (l > sizeof(*p) ? sizeof(*p) : l));\
187 187
    body += l;}
188 188

  
189
static inline void
190
sockaddr_fill_dl(struct sockaddr_dl *sa, struct iface *ifa)
191
{
192
  uint len = OFFSETOF(struct sockaddr_dl, sdl_data);
193
  memset(sa, 0, len);
194
  sa->sdl_len = len;
195
  sa->sdl_family = AF_LINK;
196
  sa->sdl_index = ifa->index;
197
}
198

  
189 199
static int
190 200
krt_send_route(struct krt_proto *p, int cmd, rte *e)
191 201
{
......
291 301
  {
292 302
    /* Fallback for all other valid cases */
293 303

  
294
#ifdef RTF_CLONING
295
    if (cmd == RTM_ADD && (i->flags & IF_MULTIACCESS) != IF_MULTIACCESS)	/* PTP */
296
      msg.rtm.rtm_flags |= RTF_CLONING;
297
#endif
298

  
304
#if __OpenBSD__
305
    /* Keeping temporarily old code for OpenBSD */
299 306
    struct ifa *addr = (net->n.addr->type == NET_IP4) ? i->addr4 : (i->addr6 ?: i->llv6);
300 307

  
301 308
    if (!addr)
......
304 311
      return -1;
305 312
    }
306 313

  
307
    sockaddr_fill(&gate, af, addr->ip, i, 0);
314
    /* Embed interface ID to link-local address */
315
    ip_addr gw = addr->ip;
316
    if (ipa_is_link_local(gw))
317
      _I0(gw) = 0xfe800000 | (i->index & 0x0000ffff);
318

  
319
    sockaddr_fill(&gate, af, gw, i, 0);
320
#else
321
    sockaddr_fill_dl(&gate, i);
322
#endif
323

  
308 324
    msg.rtm.rtm_addrs |= RTA_GATEWAY;
309 325
    break;
310 326
  }

Also available in: Unified diff