tcp: move duplicate code from tcp_v4_init_sock()/tcp_v6_init_sock()