[Xorp-hackers] doubt abt packet format(PIM)

Pavlin Radoslavov pavlin at icir.org
Fri Mar 16 12:29:06 PDT 2007


> We want to implement packet header for DF -election messages.The format is
> as under:
> 
> All DF election BIDIR-PIM control messages share the common header
>    below:
> 
>     0                   1                   2                   3
>     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
>    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>    |PIM Ver| Type  |Subtype| Rsvd  |           Checksum            |
>    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>    |               RP Address (Encoded-Unicast format)           ...
>    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>    |                   Sender Metric Preference                    |
>    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>    |                        Sender Metric                          |
>    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> 
> The Sub-type field  is to be implemented.But
> In pim.h
> 
> Struct  pim {
> .
> .
> .
> uint8_t   pim_reserved
> uint16_t pim_checksum
> .
> .
> .}

Don't use "struct pim" to access the fields.
Instead, have a look at the beginning of PimVif::pim_process()
inside pim_vif.cc. In particular, check the mechanism for accessing
the Type field and use similar mechanism to access Subtype as well.
Basically, you explicitly get the second octet from the beginning of
the packet, and you extract the top 4 bits from it.

Regards,
Pavlin


> we want to add the sub type....how do we add it without disturbing the
> already existing code.
> Is it possible to add that subtype in this structure or do we have to define
> another structure which will be only used for DF election messages.
> Also can we use the already defined flag
> #define PIM_ALL_DF_ELECTION
> in file pim.h. How can we use this flag for bidir DF election messages.
> 
> Thanking you in anticipation
> ashish karpe
> chintamani wandhre
> shamita pisal
> _______________________________________________
> Xorp-hackers mailing list
> Xorp-hackers at icir.org
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers



More information about the Xorp-hackers mailing list