본문 바로가기
IT 이론/네트워크&무선통신

ICMP Structure

by 지식id 2014. 4. 25.
반응형



Input Module은 들어오는 곳, Output Module은 나가는 곳이라고 단순히 생각 하기엔.. 오히려 Input Module에서 나가는게 더 많고 Ouput Module에선 들어오는게 더 많다. 햇갈릴 수도 있기 때문에 개념을 확실히 잡아야 한다.


Input과 Output은 ICMP packet의 출입을 기준으로 한다.

Input Module은 ICMP packet가 들어오는 곳, Output Module은 ICMP packet가 나가는 곳이다.

Input Module에서 나가는 ICMP packet은 들어온 packet의 응답 packet 뿐이다.

나머지 ICMP packet은 모두 Output Module에서 나간다.


나머지 화살표는 ICMP packet이 아닌 부수적인 정보 입출력이다.

Input Module에선 ICMP packet을 받아서 분석하고, 그에 대한 정보를 필요한 곳에 보내 줘야 하기 때문에 당연히 나가는 화살표가 많다.

Output Module에선 여러 곳에서 정보를 받아 ICMP packet으로 내보내야 되기 때문에 당연히 들어오는 화살표가 많다.


ICMP Input Module


Receive an ICMP packet from IP layer;

if(type == { Echo or Timestamp or Address Mask} ) { // 상태정보(query) 메세지인 경우

  Create a reply;

  Send the reply;

if(type == router solicitation) {  // 라우터 청원일 경우

  if(station == router) {

    Create a router advertisement;  // 라우터 정보 전송

    Send the advertisement;

  }

}

// 쿼리 메시지의 응답이거나 router advertise인 경우

if(type == reply of { Echo or Timestamp or Address Mask} || type == router advertisement ) { 

  Extract information from data;

  Deliver extracted information; // 쿼리를 보냈던 프로세스에 필요한 응답정보 전달

}

if(type == redirection) Modify routing table;  // redirection은 에러 메시지 중에서도 좀 특이한 놈이라 따로 취급

if(type == error message && type != redirection) {

  Inform the situation to source  protocol;

}


ICMP Output Module


Receive a demand

if(demand == error message) {

  if(demand from IP) 

    if(demand is forbidden) return;

  if(type == redirection message) 

    if(station != router) return;

  Create error message; // IP header를 data로 가지는 ICMP packet 생성

}

if(demand == request || demand == solicitation) {

  Create message; // 상태정보 쿼리 생성

}

Send the message;

return;



반응형

댓글