368
369 ulid_size = sizeof(struct sockaddr_in);
370 loc_in.sin_family = AF_INET;
371 rem_in.sin_family = AF_INET;
372 loc_in.sin_port = 0;
373 if (rem->port)
374 rem_in.sin_port = rem->port;
375 else
376 rem_in.sin_port = inet_sk(meta_sk)->inet_dport;
377 loc_in.sin_addr = loc->addr;
378 rem_in.sin_addr = rem->addr;
379
380 ret = sock.ops->bind(&sock, (struct sockaddr *)&loc_in, ulid_size);
381 if (ret <0) {
382 mptcp_debug("%s: MPTCP subsocket bind() failed, error %d\n",
383 __func__, ret);
384 goto error;
385 }
386
387 mptcp_debug("%s: token %#x pi %d src_addr:%pI4:%d dst_addr:%pI4:%d\n",
388 __func__, tcp_sk(meta_sk)->mpcb->mptcp_loc_token,
389 tp->mptcp->path_index, &loc_in.sin_addr,
390 ntohs(loc_in.sin_port), &rem_in.sin_addr,
391 ntohs(rem_in.sin_port));
392
393 if (tcp_sk(meta_sk)->mpcb->pm_ops->init_subsocket_v4)
394 tcp_sk(meta_sk)->mpcb->pm_ops->init_subsocket_v4(sk, rem->addr);
395
396 ret = sock.ops->connect(&sock, (struct sockaddr *)&rem_in,
397 ulid_size, O_NONBLOCK);
398 if (ret <0 && ret != -EINPROGRESS) {
399 mptcp_debug("%s: MPTCP subsocket connect() failed, error %d\n",
400 __func__, ret);
401 goto error;
402 }