Skip to content

Commit

Permalink
Allow getsockname to return the current port
Browse files Browse the repository at this point in the history
  • Loading branch information
danmanj authored and johnousterhout committed Sep 9, 2022
1 parent c5a2c05 commit acac477
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions homa_socktab.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ void homa_sock_init(struct homa_sock *hsk, struct homa *homa)
homa->next_client_port++;
}
hsk->port = homa->next_client_port;
hsk->inet.inet_sport = htons(hsk->port);
homa->next_client_port++;
hsk->socktab_links.sock = hsk;
hlist_add_head_rcu(&hsk->socktab_links.hash_links,
Expand Down Expand Up @@ -251,6 +252,7 @@ int homa_sock_bind(struct homa_socktab *socktab, struct homa_sock *hsk,
}
hlist_del_rcu(&hsk->socktab_links.hash_links);
hsk->port = port;
hsk->inet.inet_sport = htons(hsk->port);
hlist_add_head_rcu(&hsk->socktab_links.hash_links,
&socktab->buckets[homa_port_hash(port)]);
done:
Expand Down

0 comments on commit acac477

Please sign in to comment.