Auteur Sujet: TCP/UDP : Le port 0 existe-t-il ?  (Lu 29855 fois)

0 Membres et 1 Invité sur ce sujet

corrector

  • Invité
TCP/UDP : Le port 0 existe-t-il ?
« Réponse #48 le: 11 décembre 2015 à 15:33:55 »
C'est pas faux.
Pour détailler un peu plus :

0 correspond à ∅ qui signifie {}
1 correspond à {∅} qui signifie {{}}
etc.

On utilise à chaque fois l'axiome de la paire pour démontrer l'existence de l'ensemble.

Il y a un axiome qui garantit l'existence de l'ensemble des entiers, parce qu'on ne peut pas construire un ensemble infini avec les autres axiomes.

Breizh 29

  • Client Bouygues Fibre +
  • Abonné Orange Fibre
  • *
  • Messages: 4 279
  • Guilers 29820 (29N)
TCP/UDP : Le port 0 existe-t-il ?
« Réponse #49 le: 11 décembre 2015 à 20:52:35 »
Ah les matheux  ::)

corrector

  • Invité
Le port 0 existe-t-il ?
« Réponse #50 le: 12 décembre 2015 à 07:24:27 »
reserved != forbidden
"forbidden" n'existe pas dans les RFC!

tom pouce

  • Expert.
  • Abonné Sosh fibre
  • *
  • Messages: 2 611
  • Livebox Sosh - 77
TCP/UDP : Le port 0 existe-t-il ?
« Réponse #51 le: 12 décembre 2015 à 09:54:49 »
 Pour en revenir au sujet, j'ai retenu d'un papier lu en cours de sécurité l'an dernier que les attaques sur le port 0 étaient une faille connue : les firewalls habituels sont souvent un peu trop surs que les OS refuseront que l'utilisateur envoient quoi que ce soit sur ce port, tellement qu'il était ouvert par défaut et que les OS laissaient des failles béantes à ceux qui avaient l'idée de s'amuser avec ce port.

corrector

  • Invité
TCP/UDP : Le port 0 existe-t-il ?
« Réponse #52 le: 12 décembre 2015 à 10:22:19 »
De toute façon, personne ne va mettre un serveur sur un port 0, même en supposant que ça soit possible.

Donc je ne vois pas le souci.

mattmatt73

  • Expert.
  • Abonné Bbox fibre
  • *
  • Messages: 7 338
  • vancia (69)
TCP/UDP : Le port 0 existe-t-il ?
« Réponse #53 le: 12 décembre 2015 à 11:48:07 »
De toute façon, personne ne va mettre un serveur sur un port 0, même en supposant que ça soit possible.

Donc je ne vois pas le souci.

et pourquoi pas ?

personne ne pensera à aller le chercher là ... Pour certaines applications

Breizh 29

  • Client Bouygues Fibre +
  • Abonné Orange Fibre
  • *
  • Messages: 4 279
  • Guilers 29820 (29N)
TCP/UDP : Le port 0 existe-t-il ?
« Réponse #54 le: 12 décembre 2015 à 12:19:29 »

BadMax

  • Client Free adsl
  • Expert
  • *
  • Messages: 3 481
  • Malissard (26)
TCP/UDP : Le port 0 existe-t-il ?
« Réponse #55 le: 12 décembre 2015 à 14:36:12 »
Dans Linux, le port n'est pas utilisable par bind() :
Je cite http://unix.stackexchange.com/questions/180492/is-it-possible-to-connect-to-tcp-port-0
Citer
There's a comment about this in [linux kernel source]/net/ipv4/inet_connection_sock.c on inet_csk_get_port():

/* Obtain a reference to a local port for the given sock,
 * if snum is zero it means select any available local port.
 */

Which is a standard unix convention. There could be systems that will actually allow use of port 0, but that would be considered a bad practice. This behaviour is not officially specified by POSIX, IANA, or the TCP protocol, however.

Sinon IRL vous n'avez rien de plus intéressant à débattre ?

mattmatt73

  • Expert.
  • Abonné Bbox fibre
  • *
  • Messages: 7 338
  • vancia (69)
TCP/UDP : Le port 0 existe-t-il ?
« Réponse #56 le: 12 décembre 2015 à 14:58:48 »
Dans Linux, le port n'est pas utilisable par bind() :
Je cite http://unix.stackexchange.com/questions/180492/is-it-possible-to-connect-to-tcp-port-0
Sinon IRL vous n'avez rien de plus intéressant à débattre ?

on pourrait parler du résultat des élections de demain, mais vu le niveau, c'est plus intéressant l'histoire du port 0

corrector

  • Invité
TCP/UDP : Le port 0 existe-t-il ?
« Réponse #57 le: 12 décembre 2015 à 15:03:03 »
Pour demain je prédis que le gagnant sera NUL et ses propositions applicables proches de l'ensemble VIDE.

mattmatt73

  • Expert.
  • Abonné Bbox fibre
  • *
  • Messages: 7 338
  • vancia (69)
TCP/UDP : Le port 0 existe-t-il ?
« Réponse #58 le: 12 décembre 2015 à 18:48:23 »
Pour demain je prédis que le gagnant sera NUL et ses propositions applicables proches de l'ensemble VIDE.

tu es méchant, le budget régional n'est pas contraint sur au moins 10%.....

corrector

  • Invité
Le port 0 existe-t-il ?
« Réponse #59 le: 27 mars 2016 à 09:58:03 »
Sous linux :

Appel à socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)

985 static const struct net_proto_family inet_family_ops = {
986         .family = PF_INET,
987         .create = inet_create,

http://lxr.free-electrons.com/source/net/ipv4/af_inet.c#L985

249 static int inet_create(struct net *net, struct socket *sock, int protocol,
250                        int kern)
251 {
...
269         list_for_each_entry_rcu(answer, &inetsw[sock->type], list) {


Contenu de la variable inetsw :

1032 void inet_register_protosw(struct inet_protosw *p)
1033 {
...
1046         list_for_each(lh, &inetsw[p->type]) {
1047                 answer = list_entry(lh, struct inet_protosw, list);
1048                 /* Check only the non-wild match. */
1049                 if ((INET_PROTOSW_PERMANENT & answer->flags) == 0)
1050                         break;
1054         }
...
1062         list_add_rcu(&p->list, last_perm);


Appel de inet_register_protosw :

1735         for (q = inetsw_array; q < &inetsw_array[INETSW_ARRAY_LEN]; ++q)
1736                 inet_register_protosw(q);

http://lxr.free-electrons.com/source/net/ipv4/af_inet.c#L1735

Contenu de la variable inetsw_array :

994 static struct inet_protosw inetsw_array[] =
995 {
996         {
997                 .type =       SOCK_STREAM,
998                 .protocol =   IPPROTO_TCP,
...
1003         },

http://lxr.free-electrons.com/source/net/ipv4/af_inet.c#L994

Appel à listen

3177 int kernel_listen(struct socket *sock, int backlog)
3178 {
3179         return sock->ops->listen(sock, backlog);
3180 }

http://lxr.free-electrons.com/source/net/socket.c#L3177

Valeur du membre ops :

994 static struct inet_protosw inetsw_array[] =
995 {
996         {
997                 .type =       SOCK_STREAM,
998                 .protocol =   IPPROTO_TCP,
999                 .prot =       &tcp_prot,
1000                 .ops =        &inet_stream_ops,
1003         },

http://lxr.free-electrons.com/source/net/ipv4/af_inet.c#L994

Valeur sock->ops->listen :

900 const struct proto_ops inet_stream_ops = {
901         .family            = PF_INET,
...
911         .listen            = inet_listen,

http://lxr.free-electrons.com/source/net/ipv4/af_inet.c#L900

Définition de inet_listen:
191 /*
192  *      Move a socket into listening state.
193  */
194 int inet_listen(struct socket *sock, int backlog)
195 {
....
232                 err = inet_csk_listen_start(sk, backlog);

http://lxr.free-electrons.com/source/net/ipv4/af_inet.c#L191

736 int inet_csk_listen_start(struct sock *sk, int backlog)
737 {
...
753         if (!sk->sk_prot->get_port(sk, inet->inet_num)) {

http://lxr.free-electrons.com/source/net/ipv4/inet_connection_sock.c#L736

Valeur du membre sk_prot :

249 static int inet_create(struct net *net, struct socket *sock, int protocol,
250                        int kern)
251 {
...
269         list_for_each_entry_rcu(answer, &inetsw[sock->type], list) {
270
271                 err = 0;
272                 /* Check the non-wild match. */
273                 if (protocol == answer->protocol) {
274                         if (protocol != IPPROTO_IP)
275                                 break;
...
316         answer_prot = answer->prot;
...
323         sk = sk_alloc(net, PF_INET, GFP_KERNEL, answer_prot, kern);

http://lxr.free-electrons.com/source/net/ipv4/af_inet.c#L985

1389 struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
1390                       struct proto *prot, int kern)
1391 {
1392         struct sock *sk;
...
1401                 sk->sk_prot = sk->sk_prot_creator = prot;
...
1413         return sk;

http://lxr.free-electrons.com/source/net/core/sock.c#L1389

Valeur du membre get_port :

2315 struct proto tcp_prot = {
2316         .name                   = "TCP",
...
2335         .get_port               = inet_csk_get_port,

http://lxr.free-electrons.com/source/net/ipv4/tcp_ipv4.c#L2315

90 /* Obtain a reference to a local port for the given sock,
 91  * if snum is zero it means select any available local port.
 92  */
 93 int inet_csk_get_port(struct sock *sk, unsigned short snum)

http://lxr.free-electrons.com/source/net/ipv4/inet_connection_sock.c#L90

Vous avez suivi?
« Modifié: 27 mars 2016 à 11:42:12 par corrector »