Print this page
Restore SVP_R_ROUTE_REQ, and all that goes with it.
Interpret sl3a_uport == 0 in SVP_R_VL3_ACK to indicate the VL3 IP is a next-hop router.


 228 svp_remote_attach(svp_remote_t *srp, svp_t *svp)
 229 {
 230         svp_t check;
 231         avl_index_t where;
 232 
 233         mutex_enter(&srp->sr_lock);
 234         if (svp->svp_remote != NULL)
 235                 libvarpd_panic("failed to create mutex sr_lock");
 236 
 237         /*
 238          * We require everything except shootdowns
 239          */
 240         if (svp->svp_cb.scb_vl2_lookup == NULL)
 241                 libvarpd_panic("missing callback scb_vl2_lookup");
 242         if (svp->svp_cb.scb_vl3_lookup == NULL)
 243                 libvarpd_panic("missing callback scb_vl3_lookup");
 244         if (svp->svp_cb.scb_vl2_invalidate == NULL)
 245                 libvarpd_panic("missing callback scb_vl2_invalidate");
 246         if (svp->svp_cb.scb_vl3_inject == NULL)
 247                 libvarpd_panic("missing callback scb_vl3_inject");
 248         if (svp->svp_cb.scb_rvl3_lookup == NULL)
 249                 libvarpd_panic("missing callback scb_rvl3_lookup");
 250 
 251         check.svp_vid = svp->svp_vid;
 252         if (avl_find(&srp->sr_tree, &check, &where) != NULL)
 253                 libvarpd_panic("found duplicate entry with vid %ld",
 254                     svp->svp_vid);
 255         avl_insert(&srp->sr_tree, svp, where);
 256         svp->svp_remote = srp;
 257         mutex_exit(&srp->sr_lock);
 258 
 259         return (0);
 260 }
 261 
 262 void
 263 svp_remote_detach(svp_t *svp)
 264 {
 265         svp_t *lookup;
 266         svp_remote_t *srp = svp->svp_remote;
 267 
 268         if (srp == NULL)
 269                 libvarpd_panic("trying to detach remote when none exists");


 337         sqp->sq_header.svp_id = id_alloc(svp_idspace);
 338         if (sqp->sq_header.svp_id == (id_t)-1)
 339                 libvarpd_panic("failed to allcoate from svp_idspace: %d",
 340                     errno);
 341         sqp->sq_header.svp_crc32 = htonl(0);
 342         sqp->sq_rdata = vl2r;
 343         sqp->sq_rsize = sizeof (svp_vl2_req_t);
 344         sqp->sq_wdata = NULL;
 345         sqp->sq_wsize = 0;
 346 
 347         bcopy(mac, vl2r->sl2r_mac, ETHERADDRL);
 348         vl2r->sl2r_vnetid = ntohl(svp->svp_vid);
 349 
 350         mutex_enter(&srp->sr_lock);
 351         if (svp_remote_conn_queue(srp, sqp) == B_FALSE)
 352                 svp->svp_cb.scb_vl2_lookup(svp, SVP_S_FATAL, NULL, NULL, arg);
 353         mutex_exit(&srp->sr_lock);
 354 }
 355 
 356 static void
 357 svp_remote_rvl3_lookup_cb(svp_query_t *sqp, void *arg)
 358 {
 359         svp_t *svp = sqp->sq_svp;
 360         svp_rvl3_ack_t *rvl3a = (svp_rvl3_ack_t *)sqp->sq_wdata;
 361 
 362         if (sqp->sq_status == SVP_S_OK) {
 363                 svp->svp_cb.scb_rvl3_lookup(svp, sqp->sq_status,
 364                     /* XXX KEBE SAYS MORE HERE */ arg);


 365         } else {


 366         }
 367 }
 368 
 369 void
 370 svp_remote_rvl3_lookup(svp_t *svp, svp_query_t *sqp, const struct in6_addr *src,
 371     const struct in6_addr *dst, uint32_t type, uint32_t vnetid, uint16_t vlan,
 372     void *arg)
 373 {
 374         svp_remote_t *srp;
 375         svp_rvl3_req_t *rvl3r = &sqp->sq_rdun.sqd_rvl3r;
 376 
 377         srp = svp->svp_remote;
 378         sqp->sq_func = svp_remote_rvl3_lookup_cb;
 379         sqp->sq_arg = arg;
 380         sqp->sq_svp = svp;
 381         sqp->sq_state = SVP_QUERY_INIT;
 382         sqp->sq_header.svp_ver = htons(SVP_CURRENT_VERSION);
 383         sqp->sq_header.svp_op = htons(SVP_R_REMOTE_VL3_REQ);
 384         sqp->sq_header.svp_size = htonl(sizeof (svp_vl2_req_t));
 385         sqp->sq_header.svp_id = id_alloc(svp_idspace);
 386         if (sqp->sq_header.svp_id == (id_t)-1)
 387                 libvarpd_panic("failed to allcoate from svp_idspace: %d",
 388                     errno);
 389         sqp->sq_header.svp_crc32 = htonl(0);
 390         sqp->sq_rdata = rvl3r;
 391 
 392         bcopy(src, rvl3r->srl3r_srcip, sizeof (struct in6_addr));
 393         bcopy(dst, rvl3r->srl3r_dstip, sizeof (struct in6_addr));
 394         /* Caller should've checked both are the same type... */
 395         rvl3r->srl3r_type = type;
 396         rvl3r->srl3r_vnetid = vnetid;
 397         rvl3r->srl3r_vlan = vlan;
 398         rvl3r->srl3r_pad = 0;
 399 
 400         mutex_enter(&srp->sr_lock);
 401         if (!svp_remote_conn_queue(srp, sqp)) {
 402                 sqp->sq_status = SVP_S_FATAL;
 403                 sqp->sq_func(sqp, arg);
 404         }
 405         mutex_exit(&srp->sr_lock);
 406 }
 407 
 408 static void
 409 svp_remote_vl3_lookup_cb(svp_query_t *sqp, void *arg)
 410 {
 411         svp_t *svp = sqp->sq_svp;
 412         svp_vl3_ack_t *vl3a = (svp_vl3_ack_t *)sqp->sq_wdata;
 413 
 414         if (sqp->sq_status == SVP_S_OK)
 415                 svp->svp_cb.scb_vl3_lookup(svp, sqp->sq_status, vl3a->sl3a_mac,
 416                     (struct in6_addr *)vl3a->sl3a_uip, ntohs(vl3a->sl3a_uport),
 417                     arg);
 418         else




 228 svp_remote_attach(svp_remote_t *srp, svp_t *svp)
 229 {
 230         svp_t check;
 231         avl_index_t where;
 232 
 233         mutex_enter(&srp->sr_lock);
 234         if (svp->svp_remote != NULL)
 235                 libvarpd_panic("failed to create mutex sr_lock");
 236 
 237         /*
 238          * We require everything except shootdowns
 239          */
 240         if (svp->svp_cb.scb_vl2_lookup == NULL)
 241                 libvarpd_panic("missing callback scb_vl2_lookup");
 242         if (svp->svp_cb.scb_vl3_lookup == NULL)
 243                 libvarpd_panic("missing callback scb_vl3_lookup");
 244         if (svp->svp_cb.scb_vl2_invalidate == NULL)
 245                 libvarpd_panic("missing callback scb_vl2_invalidate");
 246         if (svp->svp_cb.scb_vl3_inject == NULL)
 247                 libvarpd_panic("missing callback scb_vl3_inject");
 248         if (svp->svp_cb.scb_route_lookup == NULL)
 249                 libvarpd_panic("missing callback scb_route_lookup");
 250 
 251         check.svp_vid = svp->svp_vid;
 252         if (avl_find(&srp->sr_tree, &check, &where) != NULL)
 253                 libvarpd_panic("found duplicate entry with vid %ld",
 254                     svp->svp_vid);
 255         avl_insert(&srp->sr_tree, svp, where);
 256         svp->svp_remote = srp;
 257         mutex_exit(&srp->sr_lock);
 258 
 259         return (0);
 260 }
 261 
 262 void
 263 svp_remote_detach(svp_t *svp)
 264 {
 265         svp_t *lookup;
 266         svp_remote_t *srp = svp->svp_remote;
 267 
 268         if (srp == NULL)
 269                 libvarpd_panic("trying to detach remote when none exists");


 337         sqp->sq_header.svp_id = id_alloc(svp_idspace);
 338         if (sqp->sq_header.svp_id == (id_t)-1)
 339                 libvarpd_panic("failed to allcoate from svp_idspace: %d",
 340                     errno);
 341         sqp->sq_header.svp_crc32 = htonl(0);
 342         sqp->sq_rdata = vl2r;
 343         sqp->sq_rsize = sizeof (svp_vl2_req_t);
 344         sqp->sq_wdata = NULL;
 345         sqp->sq_wsize = 0;
 346 
 347         bcopy(mac, vl2r->sl2r_mac, ETHERADDRL);
 348         vl2r->sl2r_vnetid = ntohl(svp->svp_vid);
 349 
 350         mutex_enter(&srp->sr_lock);
 351         if (svp_remote_conn_queue(srp, sqp) == B_FALSE)
 352                 svp->svp_cb.scb_vl2_lookup(svp, SVP_S_FATAL, NULL, NULL, arg);
 353         mutex_exit(&srp->sr_lock);
 354 }
 355 
 356 static void
 357 svp_remote_route_lookup_cb(svp_query_t *sqp, void *arg)
 358 {
 359         svp_t *svp = sqp->sq_svp;
 360         svp_route_ack_t *sra = (svp_route_ack_t *)sqp->sq_wdata;
 361 
 362         if (sqp->sq_status == SVP_S_OK) {
 363                 svp->svp_cb.scb_route_lookup(svp, sqp->sq_status,
 364                     sra->sra_dcid, sra->sra_vnetid, sra->sra_vlan,
 365                     sra->sra_srcmac, sra->sra_dstmac, sra->sra_port,
 366                     sra->sra_ip, sra->sra_src_pfx, sra->sra_dst_pfx, arg);
 367         } else {
 368                 svp->svp_cb.scb_route_lookup(svp, sqp->sq_status,
 369                     0, 0, 0, NULL, NULL, 0, NULL, 0, 0, arg);
 370         }
 371 }
 372 
 373 void
 374 svp_remote_route_lookup(svp_t *svp, svp_query_t *sqp,
 375     const struct in6_addr *src, const struct in6_addr *dst, uint32_t vnetid,
 376     uint16_t vlan, void *arg)
 377 {
 378         svp_remote_t *srp;
 379         svp_route_req_t *srr = &sqp->sq_rdun.sqd_rr;
 380 
 381         srp = svp->svp_remote;
 382         sqp->sq_func = svp_remote_route_lookup_cb;
 383         sqp->sq_arg = arg;
 384         sqp->sq_svp = svp;
 385         sqp->sq_state = SVP_QUERY_INIT;
 386         sqp->sq_header.svp_ver = htons(SVP_CURRENT_VERSION);
 387         sqp->sq_header.svp_op = htons(SVP_R_ROUTE_REQ);
 388         sqp->sq_header.svp_size = htonl(sizeof (svp_route_req_t));
 389         sqp->sq_header.svp_id = id_alloc(svp_idspace);
 390         if (sqp->sq_header.svp_id == (id_t)-1)
 391                 libvarpd_panic("failed to allcoate from svp_idspace: %d",
 392                     errno);
 393         sqp->sq_header.svp_crc32 = htonl(0);
 394         sqp->sq_rdata = srr;
 395 
 396         bcopy(src, srr->srr_srcip, sizeof (struct in6_addr));
 397         bcopy(dst, srr->srr_dstip, sizeof (struct in6_addr));
 398         /* Caller should've checked both are the same type... */
 399         srr->srr_vnetid = vnetid;
 400         srr->srr_vlan = vlan;
 401         srr->srr_pad = 0;

 402 
 403         mutex_enter(&srp->sr_lock);
 404         if (!svp_remote_conn_queue(srp, sqp)) {
 405                 sqp->sq_status = SVP_S_FATAL;
 406                 sqp->sq_func(sqp, arg);
 407         }
 408         mutex_exit(&srp->sr_lock);
 409 }
 410 
 411 static void
 412 svp_remote_vl3_lookup_cb(svp_query_t *sqp, void *arg)
 413 {
 414         svp_t *svp = sqp->sq_svp;
 415         svp_vl3_ack_t *vl3a = (svp_vl3_ack_t *)sqp->sq_wdata;
 416 
 417         if (sqp->sq_status == SVP_S_OK)
 418                 svp->svp_cb.scb_vl3_lookup(svp, sqp->sq_status, vl3a->sl3a_mac,
 419                     (struct in6_addr *)vl3a->sl3a_uip, ntohs(vl3a->sl3a_uport),
 420                     arg);
 421         else